Wednesday, March 12, 2014

How to receive user response in a korn shell unix script

The following is valid for korn shell but not necessarily in other shell dialects, such as bash:


print -n "Do you want to proceed? [Y/N] "
read answer
[[ $answer == [yY] ]] || { echo "Exiting..."; exit 3; }

No comments:

Post a Comment