Skip to content

Instantly share code, notes, and snippets.

@checktravis
Created February 25, 2018 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save checktravis/fc6771c1a1afa6a05d64f55b1153c36b to your computer and use it in GitHub Desktop.
Save checktravis/fc6771c1a1afa6a05d64f55b1153c36b to your computer and use it in GitHub Desktop.
#!/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