mirror of
https://github.com/octoleo/Purse.git
synced 2024-12-29 12:32:39 +00:00
commit
59f091cc81
15
pwd.sh
15
pwd.sh
@ -21,14 +21,23 @@ fail () {
|
|||||||
get_pass () {
|
get_pass () {
|
||||||
# Prompt for a password.
|
# Prompt for a password.
|
||||||
|
|
||||||
unset password
|
password=''
|
||||||
prompt="${1}"
|
prompt="${1}"
|
||||||
while IFS= read -p "${prompt}" -r -s -n 1 char ; do
|
while IFS= read -p "${prompt}" -r -s -n 1 char ; do
|
||||||
if [[ ${char} == $'\0' ]] ; then
|
if [[ ${char} == $'\0' ]] ; then
|
||||||
break
|
break
|
||||||
|
fi
|
||||||
|
if [[ ${char} == $'\177' ]]; then
|
||||||
|
if [[ -z "${password}" ]]; then
|
||||||
|
prompt=''
|
||||||
|
else
|
||||||
|
prompt=$'\b \b'
|
||||||
|
password="${password%?}"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
prompt='*'
|
prompt='*'
|
||||||
password+="${char}"
|
password+="${char}"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z ${password+x} ] ; then
|
if [ -z ${password+x} ] ; then
|
||||||
|
Loading…
Reference in New Issue
Block a user