Watch Victoria presenting simple scripts demonstrating how to capture user input into a script
Here are the scripts used in this video:
whoami.sh
#!/usr/bin/env bash echo"Please enter your name." read name echo"Hello ${name}, it’s nice to meet you!"
food.sh
#!/usr/bin/env bash echo"what are your two favourite foods?" read food1 food2 echo"Your favourite foods are: ${food1} and ${food2}"
login.sh
#!/usr/bin/env bash read-p"Enter your username: " username read-sp"Tell me your password: " password echo-e"nHi ${username}, your password is ${password}"