Created
February 25, 2018 09:37
-
-
Save checktravis/fc6771c1a1afa6a05d64f55b1153c36b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# int_ = not exported | |
# COLOR CODES https://en.wikipedia.org/wiki/ANSI_escape_code | |
NC='\033[0m' | |
BLUE='\033[0;34m' | |
int_selectHeader() { | |
printf "Select a subfolder of ${BLUE}$1${NC}:" | fold -s -w 80 | |
echo | |
} | |
selectSub() { | |
int_selectHeader $1 | |
list=`ls -l $1 | egrep '^d' | awk '{print $NF}'` | |
select dir in $list '...ABORT'; do | |
case $dir in | |
"...ABORT") echo "aborting..." | |
exit | |
;; | |
*) echo $REPLY $dir | |
TRV_SELECTED=${dir} | |
break | |
;; | |
esac | |
done | |
} | |
checkEmpty() { | |
if [ "$(ls -A $1)" ] | |
then | |
return 1 | |
else | |
return 0 | |
fi | |
} | |
export -f selectSub checkEmpty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment