From 4ddbc34b9674f83ded36c30ff46e08a5d3084b2c Mon Sep 17 00:00:00 2001 From: drduh Date: Fri, 3 Jul 2015 13:05:06 -0400 Subject: [PATCH] Style cleanup --- pwd.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pwd.sh b/pwd.sh index c0cc86c..57c4c69 100755 --- a/pwd.sh +++ b/pwd.sh @@ -26,21 +26,20 @@ get_pass () { while IFS= read -p "${prompt}" -r -s -n 1 char ; do if [[ ${char} == $'\0' ]] ; then break - fi - if [[ ${char} == $'\177' ]]; then - if [[ -z "${password}" ]]; then - prompt='' + elif [[ ${char} == $'\177' ]] ; then + if [[ -z "${password}" ]] ; then + prompt="" else prompt=$'\b \b' password="${password%?}" fi else - prompt='*' + prompt="*" password+="${char}" fi done - if [ -z ${password+x} ] ; then + if [[ -z ${password} ]] ; then fail "No password provided" fi }