Desired:
How do I pass the value to -p <parameter value> ("password") without putting it in the command line in clear text which would eventually be stored in the bash_history? Can it be stored in a file and cat <file> the password?
Actual:
The password is shown in the command line bash_history.
Usage:
sh test.sh -u username -p password
Code:
#!/bin/sh
OPTS=`getopt -o up: --long username,password -n 'parse-options' -- "$@"`
DOCKER_OPTS=""
while true; do
  case "$1" in
    -u | --username) 
             USER="$2"; shift; shift;;
    -p | --password) 
            PASS="$2"; shift;  shift ;;
    * ) break ;;            
  esac
done
if [ -z "$USER" ] || [ -z "$PASS" ] ; then
    echo "username and pass not defined"
else
    echo "username and password defined"
fi
 
    