Skip to content

Instantly share code, notes, and snippets.

@NanoDano
Created June 3, 2020 21:11
Show Gist options
  • Save NanoDano/e6d9f769c414d4a7c4fed9bcff76d32e to your computer and use it in GitHub Desktop.
Save NanoDano/e6d9f769c414d4a7c4fed9bcff76d32e to your computer and use it in GitHub Desktop.
Bash get user input
# Simple user prompt
echo -n "Enter name: "
read name
echo $name
# Read with a prompt
read -p "Enter name: " name
echo $name
# If reading from current shell and not running a separate process, use -e
read -e name
# Read with a default value
read -i "defaultName" name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment