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

@@ -25,7 +25,7 @@
#}
function create(){
if [ -e "$NOTE" -o -e ${NOTE%.*} ]; then
if [ -e "$NOTE" -o -e "${NOTE%.*}" ]; then
printf "\nERROR: Note already exists\nHint: use -e to edit the note.\n"
exit
else
@@ -33,12 +33,12 @@ function create(){
fi
if [ -z "$ENCRYPTION" ]; then
echo "TITLE: $NAME" > $NOTE
echo "DATE: $(date)" >> $NOTE
echo "TITLE: $NAME" > "$NOTE"
echo "DATE: $(date)" >> "$NOTE"
elif [ "$ENCRYPTION" == "TRUE" ]; then
touch "$NOTE"
echo "$(p_header)" | openssl enc -aes-256-cbc -salt -out "$NOTE"\
-pass pass:$ENC_KEY
p_header | openssl enc -aes-256-cbc -salt -out "$NOTE"\
-pass pass:"$ENC_KEY"
fi
echo "$NOTE"
}