![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| exit command | cdines | UNIX for Dummies Questions & Answers | 3 | 05-28-2008 04:05 AM |
| How to get exit code in a pipe-lined command? | pankai | Shell Programming and Scripting | 3 | 01-10-2008 03:36 PM |
| Getting the exit status of a remote command | zoonalex | Shell Programming and Scripting | 1 | 08-23-2006 01:58 PM |
| Move command return with exit code of 2 | handak9 | UNIX for Advanced & Expert Users | 1 | 08-26-2004 02:40 AM |
| using exit command in a shell script | jpprial | UNIX for Dummies Questions & Answers | 1 | 02-16-2001 09:45 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Emdedding my script in to exit command
Hi,
How can I call my shell script, when I execute 'exit' command? For eg. I am logging out the root login by 'exit' command. My script 'colinfo' shold execute before logging out. I don't want to use any wrapper script. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
In bash you can put the command in .bash_logout but ksh does not have this facility.
In ksh you can use the trap command in your .profile to call your script: Code:
trap '. /your_directory/logout_script' EXIT Regards |
|
#3
|
|||
|
|||
|
strait from the bash man page:
When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists. other shells have similar mechanism. |
|||
| Google The UNIX and Linux Forums |