Bash Scripting Basics Part 3 | Read input and echo output
Bash Scripting Basics Part 3 | Read input and echo output #!/bin/bash # In this script we are getting input and set it will output varname_1=Ali echo "$varname_1: Hello, who am I talking to?" echo read varname echo echo "$varname_1: Nice to meet you, $varname" echo echo "$varname: How do you do?" echo echo "$varname_1: fine thank you, $varname" echo ########################################### # Ask the user for login details read -p 'Username: ' uservar read -sp 'Password: ' passvar echo echo Thankyou $uservar we now have your login details ########################################### # We can get multiple inputs from single user like below #!/bin/bash # Demonstrate how read actually works echo What cars do you like? read car1 car2 car3 echo Your first car was: $car1 echo Your second car was: $car2 echo Your third car was: $car3