On Sat, 2 May 2020, Muhammed Suhail wrote:
Hey I'm trying to run the following script. But the program is not running
after the initial input stage:
if [[ $?=0 ]]
then
read -p 'Enter the new username' $user_name
read -p 'Enter Real name' $comment
read -p 'Enter password' $password
exit 0
else
exit 1
fi
The command-line argument approach is an
effective way to receive data input.
$1 -- $user_name
$2 -- $comment
$3 -- $password
You write the code towards validation
and subsequent processing.
Bonus, you can integrate the script at a
later point in time by a one-liner in
your new script.
If truly interactive input is required,
please use 'dialog' within your script.
Saifi.