In ksh, how do I prompt a user to enter a value, and load that value into a variable within the script?
command line
echo Please enter your name:
within the script
$myName = ?
You want read:
echo Please enter your name:
read name
echo $name
See read(1) for more.
You can do it in a single line, like so:
read -p "Please enter your name:" myName
To use variable in script
echo "The name you inputed is: $myName"
echo $myName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With