Further sanitization of variables; checks out with shellcheck.net now

This commit is contained in:
Jon-William Lewis
2015-06-10 08:35:16 -05:00
parent 9334f3ba45
commit 121abb1df7
10 changed files with 60 additions and 64 deletions

View File

@@ -1,22 +1,20 @@
function list(){
if [ -d "$BASEDIR"/"$NOTEBOOK" ]; then
echo ""
printf "Notes in $(basename $NOTEBOOK):"
echo ""
printf "\nNotes in %s:\n" "$(basename "$NOTEBOOK")"
NOTES=( $(find $BASEDIR/$NOTEBOOK -name "*.$EXT" -print0 | sed s:$BASEDIR/$NOTEBOOK/:" ":g | sed -e s:".$EXT"::g | tr "/" " ") )
NOTES=( $(find "$BASEDIR"/"$NOTEBOOK" -name "*.$EXT" -print0 | sed s:"$BASEDIR"/"$NOTEBOOK"/: " " :g | sed -e s:".$EXT"::g | tr "/" " ") )
let i=0
for NOTE in ${NOTES[@]}; do
if [ -d $BASEDIR/$NOTEBOOK/$NOTE ]; then
for NOTE in "${NOTES[@]}"; do
if [ -d "$BASEDIR"/"$NOTEBOOK"/"$NOTE" ]; then
if [ "$LAST_SECTION" != "$NOTE" ]; then
printf " Section: $NOTE\n"
printf " Section: %s\n" "$NOTE"
fi
LAST_SECTION=$NOTE
LAST_SECTION="$NOTE"
else
#if [ $(($i % 1)) -eq 0 ]; then
# printf "\n "
#fi
printf " $NOTE\n"
printf " %s\n" "$NOTE"
fi
let i++
done