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.
# 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"\
"Note already exists"\
"Hint: use -e to edit the note."
@@ -15,7 +15,7 @@ function create(){
# If the note's notebook/section does not exist,
# create the appropriate folders.
mkdir -p "$NOTE_DIR"/$(dirname "$NOTE")
mkdir -p "$NOTES_DIR"/"$(dirname "$NOTE")"
# Write the standard note header
if [ "$ENCRYPTION" == "TRUE" ]; then
@@ -23,10 +23,10 @@ function create(){
p_header > "$TMP_NOTE"
encrypt
else
p_header > "$NOTE_DIR/$NOTE"
p_header > "$NOTES_DIR/$NOTE"
fi
# 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%.*}"
else
>&2 printf " $RED_COLOR!$RESET_COLOR%s\n"\

View File

@@ -2,8 +2,8 @@ function delete(){
# Requires: $NOTE, $NOTE_DIR
# Given a valid $NOTE, delete removes $NOTE from sns.
if [ -e "$NOTE_DIR/$NOTE" ]; then
rm "$NOTE_DIR/$NOTE"
if [ -e "$NOTES_DIR/$NOTE" ]; then
rm "$NOTES_DIR/$NOTE"
printf " - %s\n" "Deleted note: ${NOTE%.*}."
else
>&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 [ "$ENCRYPTION" == "TRUE" ]; then decrypt #to stdout
else cat "$NOTE" fi
else cat "$NOTE"; fi
else
>&2 printf " $RED_COLOR!$RESET_COLOR %s\n\t%s\n"\
"Note cannot be found."