In ksh, how can I suggest a user to enter a value and load that value into a variable in a script?
Command line
echo Please enter your name:
in script
$myName = ?
Do you want to read:
echo Please enter your name: read name echo $name
See (1) for more details.
You can do this in one line, for example:
read -p "Please enter your name:" myName
To use a variable in a script
echo "The name you inputed is: $myName" echo $myName
it is better if you create a myname value with let and the script is as follows:
#!/bin/bash let myname echo "enter your name : " read myname echo "your name is $myname"