Project

General

Profile

1
#!/bin/bash
2
# Sets a password environment variable
3

    
4
test "$#" -eq 1 || \
5
{ echo "Usage: . $0 env_var_name (note the initial \".\")" >&2; exit 2;}
6

    
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
(2-2/14)