From fa2431f54e6fcf4ba9c1a827fcc033fc2ef84ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie?= Date: Wed, 8 Jul 2015 10:19:04 +0200 Subject: [PATCH] User can enter upper or lowercase on y/n|r/w/d prompt --- pwd.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pwd.sh b/pwd.sh index 63e4734..a11c9fb 100755 --- a/pwd.sh +++ b/pwd.sh @@ -137,7 +137,7 @@ create_username () { read -p " Generate password? (y/n, default: y) " rand_pass - if [ "${rand_pass}" == "n" ]; then + if [[ "${rand_pass}" =~ ^([nN][oO]|[nN])$ ]]; then get_pass " Enter password for \"${username}\": " ; echo userpass=$password @@ -163,9 +163,9 @@ sanity_check read -n 1 -p "Read, write, or delete password? (r/w/d, default: r) " action printf "\n" -if [ "${action}" == "w" ] ; then +if [[ "${action}" =~ ^([wW])$ ]] ; then create_username && write_pass -elif [ "${action}" == "d" ] ; then +elif [[ "${action}" =~ ^([dD])$ ]] ; then read -p " Username to delete? " username && write_pass else