Trying to use the "read command" to accept user input from the command prompt itself but my script doesnt seem to be moving forward
echo "Do you want to continue?(yes/no)" read -p $1 if [ "$1" == "yes" ] then sleep 5s echo "" echo " move ahead" else echo "" echo "Skipping The Step.." echo "" sleep 5s fi
I want to execute the script like this..
sh script.sh yes sh script.sh no
Added a -p to the above script and all seems to work very well. This is my real problem. I have another script test.sh which calls script.sh. So this is how i put the input
cat test.sh yes #!/bin/bash echo "execute the below script" sh script.sh $1 sh test.sh yes
This way doesnt work as the script picks up a default no and moves ahead. Any ideas.