root/scripts/util/env_password @ 250
1 | 183 | aaronmk | #!/bin/bash
|
---|---|---|---|
2 | 131 | aaronmk | # Sets a password environment variable
|
3 | |||
4 | 186 | aaronmk | test "$#" -eq 1 || \ |
5 | { echo "Usage: . $0 env_var_name (note the initial \".\")" >&2; exit 2;} |
||
6 | 131 | aaronmk | |
7 | if test -z "${!1+t}"; then # env var with name $1 is unset |
||
8 | read -s -p "Enter $1: "; echo |
||
9 | export "$1"="$REPLY" |
||
10 | fi
|