Replaced all [ p -o q ] with [ p ] || [ q ] and all [ p -a q ] with [ p ] && [ q ]

This commit is contained in:
Jon-William Lewis
2015-09-19 18:23:47 -05:00
committed by Jon-William Lewis
parent 6e7f4c3e95
commit 337a1bf3a3
6 changed files with 32 additions and 32 deletions

32
sns.sh
View File

@@ -98,7 +98,7 @@ function decrypt(){
#} #}
function create(){ function create(){
if [ -e "$NOTE" -o -e "${NOTE%.*}" ]; then if [ -e "$NOTE" ] || [ -e "${NOTE%.*}" ]; then
printf "\nERROR: Note already exists\nHint: use -e to edit the note.\n" printf "\nERROR: Note already exists\nHint: use -e to edit the note.\n"
exit exit
else else
@@ -117,7 +117,7 @@ function create(){
} }
function delete(){ function delete(){
if [ "$DELETE" == "TRUE" ]; then if [ "$DELETE" == "TRUE" ]; then
if [ -e "$NOTE" -o -e "${NOTE%.*}" ]; then if [ -e "$NOTE" ] || [ -e "${NOTE%.*}" ]; then
if [ "$ENCRYPTION" == "TRUE" ]; then if [ "$ENCRYPTION" == "TRUE" ]; then
rm "${NOTE%.*}" rm "${NOTE%.*}"
else else
@@ -154,7 +154,7 @@ if [ "$ENCRYPTION" == "TRUE" ]; then encrypt; fi
} }
function print(){ function print(){
if [ "$PRINT" == "TRUE" ]; then if [ "$PRINT" == "TRUE" ]; then
if [ -r "$NOTE" -o -r "${NOTE%.*}" ]; then if [ -r "$NOTE" ] || [ -r "${NOTE%.*}" ]; then
if [ -z "$CREATE" ]; then if [ -z "$CREATE" ]; then
if [ "$ENCRYPTION" == "TRUE" ]; then if [ "$ENCRYPTION" == "TRUE" ]; then
openssl enc -d -aes-256-cbc -in "${NOTE%.*}" -pass pass:"$ENC_KEY" openssl enc -d -aes-256-cbc -in "${NOTE%.*}" -pass pass:"$ENC_KEY"
@@ -234,7 +234,7 @@ if [ -n "$ERR_NO_KEY" ]; then
echo " Warning: No encryption key was provided. Encryption disabled." echo " Warning: No encryption key was provided. Encryption disabled."
fi fi
if [ -n "$ERR_NO_SSL" -o -n "$ERR_NO_KEY" ]; then if [ -n "$ERR_NO_SSL" ] || [ -n "$ERR_NO_KEY" ]; then
pause pause
fi fi
@@ -252,22 +252,22 @@ if [ -z "$1" ]; then help; exit 20
else else
ARGS=( "$@" ) ARGS=( "$@" )
for ARG in "${ARGS[@]}"; do for ARG in "${ARGS[@]}"; do
if [ "$ARG" = "-c" -o "$ARG" = "--create" ]; then CREATE="TRUE" if [ "$ARG" = "-c" ] || [ "$ARG" = "--create" ]; then CREATE="TRUE"
elif [ "$ARG" = "-d" -o "$ARG" = "--delete" ]; then DELETE="TRUE" elif [ "$ARG" = "-d" ] || [ "$ARG" = "--delete" ]; then DELETE="TRUE"
elif [ "$ARG" = "-e" -o "$ARG" = "--edit" ]; then EDIT="TRUE" elif [ "$ARG" = "-e" ] || [ "$ARG" = "--edit" ]; then EDIT="TRUE"
elif [ "$ARG" = "-ce" -o "$ARG" = "-ec" ]; then EDIT="TRUE"; CREATE="TRUE" elif [ "$ARG" = "-ce" ] || [ "$ARG" = "-ec" ]; then EDIT="TRUE"; CREATE="TRUE"
elif [ "$ARG" = "-p" -o "$ARG" = "--print" ]; then PRINT="TRUE" elif [ "$ARG" = "-p" ] || [ "$ARG" = "--print" ]; then PRINT="TRUE"
elif [ "$ARG" = "-l" -o "$ARG" = "--list" ]; then LIST="TRUE" elif [ "$ARG" = "-l" ] || [ "$ARG" = "--list" ]; then LIST="TRUE"
elif [ "$ARG" = "-h" -o "$ARG" == "--help" ]; then help; exit 0 elif [ "$ARG" = "-h" ] || [ "$ARG" == "--help" ]; then help; exit 0
elif [ "$ARG" = "-w" -o "$ARG" == "--wconf" ]; then w_conf; exit 0 elif [ "$ARG" = "-w" ] || [ "$ARG" == "--wconf" ]; then w_conf; exit 0
else else
if [ -z "$NAME" -a -n "$ARG" ]; then NAME="$ARG" if [ -z "$NAME" ] && [ -n "$ARG" ]; then NAME="$ARG"
elif [ -z "$NOTEBOOK" -a -n "$ARG" ]; then NOTEBOOK="$ARG" elif [ -z "$NOTEBOOK" ] && [ -n "$ARG" ]; then NOTEBOOK="$ARG"
elif [ -z "$SECTION" -a -n "$ARG" ]; then SECTION="$ARG" elif [ -z "$SECTION" ] && [ -n "$ARG" ]; then SECTION="$ARG"
fi fi
fi fi
done done
if [ -n "$NAME" -a -z "$NOTEBOOK" -a -n "$LIST" ]; then if [ -n "$NAME" ] && [ -z "$NOTEBOOK" ] && [ -n "$LIST" ]; then
# If we got a note title above, but no notebook, and the list option # If we got a note title above, but no notebook, and the list option
# was specified, we assume that the detected note title is actually a # was specified, we assume that the detected note title is actually a
# notebook name. # notebook name.

View File

@@ -25,7 +25,7 @@
#} #}
function create(){ function create(){
if [ -e "$NOTE" -o -e "${NOTE%.*}" ]; then if [ -e "$NOTE" ] || [ -e "${NOTE%.*}" ]; then
printf "\nERROR: Note already exists\nHint: use -e to edit the note.\n" printf "\nERROR: Note already exists\nHint: use -e to edit the note.\n"
exit exit
else else

View File

@@ -1,6 +1,6 @@
function delete(){ function delete(){
if [ "$DELETE" == "TRUE" ]; then if [ "$DELETE" == "TRUE" ]; then
if [ -e "$NOTE" -o -e "${NOTE%.*}" ]; then if [ -e "$NOTE" ] || [ -e "${NOTE%.*}" ]; then
if [ "$ENCRYPTION" == "TRUE" ]; then if [ "$ENCRYPTION" == "TRUE" ]; then
rm "${NOTE%.*}" rm "${NOTE%.*}"
else else

View File

@@ -1,6 +1,6 @@
function print(){ function print(){
if [ "$PRINT" == "TRUE" ]; then if [ "$PRINT" == "TRUE" ]; then
if [ -r "$NOTE" -o -r "${NOTE%.*}" ]; then if [ -r "$NOTE" ] || [ -r "${NOTE%.*}" ]; then
if [ -z "$CREATE" ]; then if [ -z "$CREATE" ]; then
if [ "$ENCRYPTION" == "TRUE" ]; then if [ "$ENCRYPTION" == "TRUE" ]; then
openssl enc -d -aes-256-cbc -in "${NOTE%.*}" -pass pass:"$ENC_KEY" openssl enc -d -aes-256-cbc -in "${NOTE%.*}" -pass pass:"$ENC_KEY"

View File

@@ -32,7 +32,7 @@ if [ -n "$ERR_NO_KEY" ]; then
echo " Warning: No encryption key was provided. Encryption disabled." echo " Warning: No encryption key was provided. Encryption disabled."
fi fi
if [ -n "$ERR_NO_SSL" -o -n "$ERR_NO_KEY" ]; then if [ -n "$ERR_NO_SSL" ] || [ -n "$ERR_NO_KEY" ]; then
pause pause
fi fi

View File

@@ -9,22 +9,22 @@ if [ -z "$1" ]; then help; exit 20
else else
ARGS=( "$@" ) ARGS=( "$@" )
for ARG in "${ARGS[@]}"; do for ARG in "${ARGS[@]}"; do
if [ "$ARG" = "-c" -o "$ARG" = "--create" ]; then CREATE="TRUE" if [ "$ARG" = "-c" ] || [ "$ARG" = "--create" ]; then CREATE="TRUE"
elif [ "$ARG" = "-d" -o "$ARG" = "--delete" ]; then DELETE="TRUE" elif [ "$ARG" = "-d" ] || [ "$ARG" = "--delete" ]; then DELETE="TRUE"
elif [ "$ARG" = "-e" -o "$ARG" = "--edit" ]; then EDIT="TRUE" elif [ "$ARG" = "-e" ] || [ "$ARG" = "--edit" ]; then EDIT="TRUE"
elif [ "$ARG" = "-ce" -o "$ARG" = "-ec" ]; then EDIT="TRUE"; CREATE="TRUE" elif [ "$ARG" = "-ce" ] || [ "$ARG" = "-ec" ]; then EDIT="TRUE"; CREATE="TRUE"
elif [ "$ARG" = "-p" -o "$ARG" = "--print" ]; then PRINT="TRUE" elif [ "$ARG" = "-p" ] || [ "$ARG" = "--print" ]; then PRINT="TRUE"
elif [ "$ARG" = "-l" -o "$ARG" = "--list" ]; then LIST="TRUE" elif [ "$ARG" = "-l" ] || [ "$ARG" = "--list" ]; then LIST="TRUE"
elif [ "$ARG" = "-h" -o "$ARG" == "--help" ]; then help; exit 0 elif [ "$ARG" = "-h" ] || [ "$ARG" == "--help" ]; then help; exit 0
elif [ "$ARG" = "-w" -o "$ARG" == "--wconf" ]; then w_conf; exit 0 elif [ "$ARG" = "-w" ] || [ "$ARG" == "--wconf" ]; then w_conf; exit 0
else else
if [ -z "$NAME" -a -n "$ARG" ]; then NAME="$ARG" if [ -z "$NAME" ] && [ -n "$ARG" ]; then NAME="$ARG"
elif [ -z "$NOTEBOOK" -a -n "$ARG" ]; then NOTEBOOK="$ARG" elif [ -z "$NOTEBOOK" ] && [ -n "$ARG" ]; then NOTEBOOK="$ARG"
elif [ -z "$SECTION" -a -n "$ARG" ]; then SECTION="$ARG" elif [ -z "$SECTION" ] && [ -n "$ARG" ]; then SECTION="$ARG"
fi fi
fi fi
done done
if [ -n "$NAME" -a -z "$NOTEBOOK" -a -n "$LIST" ]; then if [ -n "$NAME" ] && [ -z "$NOTEBOOK" ] && [ -n "$LIST" ]; then
# If we got a note title above, but no notebook, and the list option # If we got a note title above, but no notebook, and the list option
# was specified, we assume that the detected note title is actually a # was specified, we assume that the detected note title is actually a
# notebook name. # notebook name.