I'm partway writing a script on Linux and I wanted to add an extra bit and ask the user whether they want to quit the program, can anyone help me in figuring out how I can do this?
Take the 2-minute tour
×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
Try this:
|
|||
|
echo -n "Do you want to stop? "; read answer; if [ "$answer" = y ]; then exit 0; fi
– wurtel Sep 29 '14 at 13:47trap
to perform any housekeeping. – unxnut Sep 29 '14 at 13:50