Hiding credentials on the command line

Some commands require sensitive information to be passed on the command line. If we don't want these to show up in the command history, we can use read with the -s flag to store secret values in variables:

read -p "PASSWORD: " -s mypass
cmd login --creds user:${mypass}

Last updated