Created
June 3, 2020 21:11
-
-
Save NanoDano/e6d9f769c414d4a7c4fed9bcff76d32e to your computer and use it in GitHub Desktop.
Bash get user input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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