Alias or shell script to confirm 'exit' commands from a shell
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Alias or shell script to confirm 'exit' commands from a shell
I use PuTTy to connect to multiple servers at work, and am usually jumping between various su <user> layers all day. Therefore, typing 'exit' to get back down to the user I need to be next is pretty frequent.
However, sometimes I actually am just logged on as myself, and habitually type 'exit' instead of 'cd' or something like that. Is there a way to write a shell script called 'exit.sh' which would prompt me with "Sure you want to exit? [Y/N]" and if I type 'Y' would actually exit the window ...'N' would just exit the script?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.