Script was modified to pass shellcheck

This commit is contained in:
Jon-William Lewis
2016-02-15 11:36:08 -06:00
parent 7085a46ef3
commit ca398122f3
4 changed files with 8 additions and 8 deletions

View File

@@ -6,7 +6,7 @@ function create(){
# by p_header, to $NOTE. # by p_header, to $NOTE.
# Refuse to overwrite a note # Refuse to overwrite a note
if [ -e "$NOTE_DIR/$NOTE" ]; then if [ -e "$NOTES_DIR/$NOTE" ]; then
>&2 printf " $RED_COLOR!$RESET_COLOR %s\n\t%s\n"\ >&2 printf " $RED_COLOR!$RESET_COLOR %s\n\t%s\n"\
"Note already exists"\ "Note already exists"\
"Hint: use -e to edit the note." "Hint: use -e to edit the note."
@@ -15,7 +15,7 @@ function create(){
# If the note's notebook/section does not exist, # If the note's notebook/section does not exist,
# create the appropriate folders. # create the appropriate folders.
mkdir -p "$NOTE_DIR"/$(dirname "$NOTE") mkdir -p "$NOTES_DIR"/"$(dirname "$NOTE")"
# Write the standard note header # Write the standard note header
if [ "$ENCRYPTION" == "TRUE" ]; then if [ "$ENCRYPTION" == "TRUE" ]; then
@@ -23,10 +23,10 @@ function create(){
p_header > "$TMP_NOTE" p_header > "$TMP_NOTE"
encrypt encrypt
else else
p_header > "$NOTE_DIR/$NOTE" p_header > "$NOTES_DIR/$NOTE"
fi fi
# Make sure the note exists, and inform the user of the result. # Make sure the note exists, and inform the user of the result.
if [ -e "$NOTE_DIR/$NOTE" ]; then if [ -e "$NOTES_DIR/$NOTE" ]; then
printf " - %s\n" "Created note: ${NOTE%.*}" printf " - %s\n" "Created note: ${NOTE%.*}"
else else
>&2 printf " $RED_COLOR!$RESET_COLOR%s\n"\ >&2 printf " $RED_COLOR!$RESET_COLOR%s\n"\

View File

@@ -2,8 +2,8 @@ function delete(){
# Requires: $NOTE, $NOTE_DIR # Requires: $NOTE, $NOTE_DIR
# Given a valid $NOTE, delete removes $NOTE from sns. # Given a valid $NOTE, delete removes $NOTE from sns.
if [ -e "$NOTE_DIR/$NOTE" ]; then if [ -e "$NOTES_DIR/$NOTE" ]; then
rm "$NOTE_DIR/$NOTE" rm "$NOTES_DIR/$NOTE"
printf " - %s\n" "Deleted note: ${NOTE%.*}." printf " - %s\n" "Deleted note: ${NOTE%.*}."
else else
>&2 printf " $RED_COLOR!$RESET_COLOR %s\n" "Note ${NOTE%.*} does not exist." >&2 printf " $RED_COLOR!$RESET_COLOR %s\n" "Note ${NOTE%.*} does not exist."

View File

@@ -3,7 +3,7 @@ function print(){
if [ -r "$NOTE" ]; then if [ -r "$NOTE" ]; then
if [ "$ENCRYPTION" == "TRUE" ]; then decrypt #to stdout if [ "$ENCRYPTION" == "TRUE" ]; then decrypt #to stdout
else cat "$NOTE" fi else cat "$NOTE"; fi
else else
>&2 printf " $RED_COLOR!$RESET_COLOR %s\n\t%s\n"\ >&2 printf " $RED_COLOR!$RESET_COLOR %s\n\t%s\n"\
"Note cannot be found." "Note cannot be found."

View File

@@ -11,7 +11,7 @@ else
fi fi
if [ "$ENCRYPTION" == "TRUE" ]; then if [ "$ENCRYPTION" == "TRUE" ]; then
if [ ! -r $(which gpg) ]; then if [ ! -r "$(which gpg)" ]; then
>&2 printf " $RED_COLOR!$RESET_COLOR %s\n\t%s\n"\ >&2 printf " $RED_COLOR!$RESET_COLOR %s\n\t%s\n"\
"Encryption was specified, but GPG is not installed." "Encryption was specified, but GPG is not installed."
exit 100 exit 100