attempt to reduce lines by using OR instead of elif

This commit is contained in:
Shihaam Abdul Rahman 2021-05-02 00:36:26 +05:00
parent 5f757b26c6
commit 2387c561e7
5 changed files with 5 additions and 30 deletions

View File

@ -11,12 +11,9 @@ echo ""
printf 'Select contact type[1]: '
read -r CONTACT_TYPE
if [ "$CONTACT_TYPE" = "1" ]
if [ "$CONTACT_TYPE" = "1" ] || [ "$CONTACT_TYPE" = "" ]
then
source addcontact-bml.sh
elif [ "$CONTACT_TYPE" = "" ]
then
source addcontact-bml.sh
elif [ "$CONTATC_TYPE" = "2" ]
then
echo "${red}WORK IN PROGRESS${reset}"

View File

@ -18,10 +18,7 @@ then
elif [ "$CONTACTS" = "3" ]
then
source deletecontact.sh
elif [ "$CONTACTS" = "4" ]
then
source mainmenu.sh
elif [ "$CONTACTS" = "back" ]
elif [ "$CONTACTS" = "4" ] || [ "$CONTACTS" = "back" ]
then
sleep 0.2
source mainmenu.sh

View File

@ -1,6 +1,6 @@
#!/bin/bash
if [ "uname -r | grep -oE microsoft" = "microsoft" ]
if [ "uname -r | grep -oE microsoft" = "microsoft" ] || [ "uname -r | grep -oE Microsoft" = "Microsoft" ]
then
WSL=true
#echo "${red}WSL Not Supported!${reset}" 1>&2

View File

@ -3,7 +3,7 @@ then
if [ "$LOGIN" = "0" ]
then
read -p 'Do you want to save login? [y/N] ' SAVE_LOGIN
if [ "$SAVE_LOGIN" = "Y" ]
if [ "$SAVE_LOGIN" = "Y" ] || [ "$SAVE_LOGIN" = "y" ]
then
read -s -p 'Enter Pin: ' PIN
echo ""
@ -22,25 +22,6 @@ then
echo "${red}Pin do not match${reset}"
source savepass.sh
fi
elif [ "$SAVE_LOGIN" = "y" ]
then
read -s -p 'Enter Pin: ' PIN
echo ""
read -s -p 'Repeat Pin: ' REPEAT_PIN
if [ "$PIN" = "$REPEAT_PIN" ]
then
echo ""
echo "Your credentials are ${lightgreen}encrypted${reset} and saved in $CREDENTIALS"
BML_USERNAME=$(echo "${BML_USERNAME}" | openssl enc -e -des3 -base64 -pass pass:${PIN} -pbkdf2)
BML_PASSWORD=$(echo "${BML_PASSWORD}" | openssl enc -e -des3 -base64 -pass pass:${PIN} -pbkdf2)
echo "BML_USERNAME='${BML_USERNAME}'" > $CREDENTIALS
echo "BML_PASSWORD='${BML_PASSWORD}'" >> $CREDENTIALS
else
echo ""
echo "${red}Pin do not match${reset}"
source savepass.sh
fi
else
:
fi

View File

@ -14,7 +14,7 @@ then
elif [ "$SETTINGS" = "2" ]
then
source changepassword.sh
elif [ "$SETTINGS" = "back" ]
elif [ "$SETTINGS" = "2" ] || [ "$SETTINGS" = "back" ]
then
source mainmenu.sh
elif [ "$SETTINGS" = "clear" ]