Further sanitization of variables; checks out with shellcheck.net now
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user