Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash get user input

#!/bin/bash
### Simple bash script to ask a user for their name
# First, echo the question
echo Hello, what is your name?
# Next, get the user input
read varname
# Finally, echo the response using the users input that we got in the previous step
echo It's nice to meet you $varname
 
PREVIOUS NEXT
Tagged: #bash #user #input
ADD COMMENT
Topic
Name
5+7 =