John Sheehy
asked on
Adding a continue option in a script
So my script does many things and it does them rather fast thanks to all that have helped out over the past two days. I would like to pause the script and allow the user to hit Y to continue is this possible and if so, how?
Thanks
John
Thanks
John
ASKER
I would love it to say the following:
Press Y to to continue or X to Exit...
And then they press the appropriate key.
Does that make better sense?
Thanks
John
Press Y to to continue or X to Exit...
And then they press the appropriate key.
Does that make better sense?
Thanks
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The "read" statement under ksh would look like this:
read A?"Press Y to to continue or X to Exit..."
All other stuff can remain the same.
read A?"Press Y to to continue or X to Exit..."
All other stuff can remain the same.
ASKER
OK, I will try it out and let you know within 30 min.
ASKER
I am getting the following error:
[[N!=Y]]: not Found
Thoughts?
John
[[N!=Y]]: not Found
Thoughts?
John
The variables/strings must be separated from the double square brackets as well as from the comparison operator by spaces:
[[ $A != "Y" ]]
[[ $A != "Y" ]]
ASKER
Ok, Ill give that a try. Thanks
ASKER
The solution worked out great. Sorry it took so long to respond.
A="N"
while [[ $A != "Y" ]]
do
read A
done
Otherwise (if it can be any character or even just the <Enter> key) a simple
read A
would suffice.