• [read command][] shell cheatsheet
  • Input Python cheatsheet

Get value

echo -n Password: 
read USER_VALUE
echo

echo $USER_VALUE

Get password

This hides the input from the terminal.

Based on SO discussion.

Some shells can do this in one line:

read -s -p "Password:" USER_PASSWORD
echo $USER_PASSWORD

Otherwise in two lines as echo -n and read.

echo -n Password: 
read -s USER_PASSWORD
echo

echo $USER_PASSWORD

Some shells wonโ€™t do echo -n so then use printf.