The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-01-2008
Registered User
 

Join Date: Feb 2007
Posts: 36
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.
Reply With Quote
Forum Sponsor
  #2  
Old 03-01-2008
Moderator
 

Join Date: Feb 2007
Posts: 2,331
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
Reply With Quote
  #3  
Old 03-05-2008
Registered User
 

Join Date: May 2006
Posts: 101
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.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0