From aaae88a2a7961201baaf6de1a0f4d28ae32dedb2 Mon Sep 17 00:00:00 2001 From: Derek Taylor Date: Fri, 8 Nov 2019 16:33:56 -0600 Subject: [PATCH] Adding script from Bash video. --- new.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 new.sh diff --git a/new.sh b/new.sh new file mode 100755 index 0000000..2b41afc --- /dev/null +++ b/new.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# ____ _____ +# | _ \_ _| Derek Taylor (DistroTube) +# | | | || | http://www.youtube.com/c/DistroTube +# | |_| || | http://www.gitlab.com/dwt1/ +# |____/ |_| +# +# This is a test script + +myDir='/home/dt/test/' + +dirOptions=$(cd ${myDir} && /bin/ls -d */ | cut -d " " -f 1) +dirChoice=$(echo -e "${dirOptions[@]}\nquit" | dmenu -i -p 'My directories: ') + +if [ "$dirChoice" == "quit" ]; then + echo "Program terminated." +elif [ "$dirChoice" == ${dirChoice} ]; then + fileOptions=$(cd ${myDir}${dirChoice} && /bin/ls -Ap | cut -d " " -f 1 | grep -v / ) + fileChoice=$(echo -e "${fileOptions[@]}" | dmenu -i -l 15 -p 'Edit this file: ') + exec emacsclient -c ${myDir}${dirChoice}${fileChoice} +fi