Revision 292
Added by Aaron Marcuse-Kubitza about 13 years ago
env_password | ||
---|---|---|
3 | 3 |
|
4 | 4 |
self="$(readlink -f -- "$BASH_SOURCE")" |
5 | 5 |
|
6 |
noInstr= |
|
7 |
test _"$1" = _- && { noInstr=1; shift;} |
|
8 |
|
|
6 | 9 |
test "$#" -ge 1 || \ |
7 | 10 |
{ echo "Usage: . $self env_var_name [msg] (note initial \".\")" >&2; exit 2;} |
8 | 11 |
|
... | ... | |
15 | 18 |
} |
16 | 19 |
|
17 | 20 |
if test -z "${!1+t}"; then # env var with name $1 is unset |
18 |
echo "[7m To avoid having to reenter $msg password, run: [0m" >&2 |
|
19 |
trace . "$self" "$@" |
|
21 |
if test -z "$noInstr"; then |
|
22 |
echo "[7m To avoid having to reenter $msg password, run: [0m" >&2 |
|
23 |
trace . "$self" - "$@" |
|
24 |
fi |
|
20 | 25 |
read -s -p "Enter $msg password: "; echo |
21 | 26 |
export "$1"="$REPLY" |
22 | 27 |
fi |
Also available in: Unified diff
env_password: Don't print instructions for storing password for the session if called to store password for the session