LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Alias or shell script to confirm 'exit' commands from a shell (http://www.linuxquestions.org/questions/programming-9/alias-or-shell-script-to-confirm-exit-commands-from-a-shell-422911/)

rose_bud4201 03-08-2006 02:24 PM

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?

acid_kewpie 03-08-2006 02:29 PM

alias exit='dialog --yesno really\ exit? 5 20; [ $? == 0 ] && exit'

rose_bud4201 03-08-2006 02:34 PM

I have no idea what that is or why it works, but it does, and therefore you are AWESOME :D

Thank you!


All times are GMT -5. The time now is 07:21 AM.