User Input

Prompt for user input in a shell script

How to prompt users in your shell script, like asking answer Yes or No? In this article we look at options to achieve this.


Shell scripts can be powerful for automation. Sometimes, we want to ask the user for input. Let’s have a look at a few options that can be very handy for your next shell script! Fill a variable with input provided by the user If we like the user to provide us with some details, like a name, email address, or hostname, we can use the read command. read -p "What is your name?