LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 01-23-2007, 11:23 AM   #1
supersubu123
LQ Newbie
 
Registered: Jan 2007
Distribution: Suse 10.2
Posts: 18

Rep: Reputation: 0
Lightbulb what is the script which runs at the exit bash shell


hi
this is my first qn in this forum.
.bashrc runs at the startup of bash shell(am i correct?)
is there any similar script which would run at the time exiting the bash shell alone.
my aim is to set some environmental variables when entering the bash shell.
and again resetting them to their original values when i exit it.
 
Old 01-23-2007, 11:53 AM   #2
MOS JEFF-INITELY
Member
 
Registered: Sep 2006
Distribution: Windows .. MUAHAHAHA
Posts: 66

Rep: Reputation: 15
.bash_logout

ease-e
 
Old 01-23-2007, 12:00 PM   #3
zhangmaike
Member
 
Registered: Oct 2004
Distribution: Slackware
Posts: 376

Rep: Reputation: 30
As far as I know, environment variables will not be altered outside of a particular instance of bash (or some other shell) anyway:
Code:
zmk@darkstar:~$ export TEST=a
zmk@darkstar:~$ echo $TEST
a
zmk@darkstar:~$ bash
zmk@darkstar:~$ export TEST=b
zmk@darkstar:~$ echo $TEST
b
zmk@darkstar:~$ exit
exit
zmk@darkstar:~$ echo $TEST
a
zmk@darkstar:~$
I have no .bash_logout script.
 
Old 01-23-2007, 12:02 PM   #4
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,121

Rep: Reputation: 121Reputation: 121
Quote:
Originally Posted by supersubu123
hi
this is my first qn in this forum.
.bashrc runs at the startup of bash shell(am i correct?)
is there any similar script which would run at the time exiting the bash shell alone.
my aim is to set some environmental variables when entering the bash shell.
and again resetting them to their original values when i exit it.
Actually .bashrc is not run at startup unless invoked by /etc/profile then ~/.bash_profile

To understand more about the order, check out this from a quick google search: http://linuxreviews.org/beginner/Bas.../en/c1309.html
 
Old 01-24-2007, 08:49 AM   #5
supersubu123
LQ Newbie
 
Registered: Jan 2007
Distribution: Suse 10.2
Posts: 18

Original Poster
Rep: Reputation: 0
thanks

thank u all for the useful info
seems we can create .bash_logout optionally
 
Old 01-24-2007, 11:16 AM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,121

Rep: Reputation: 121Reputation: 121
Quote:
Originally Posted by supersubu123
seems we can create .bash_logout optionally
Yes and for anyone that didn't know, all of the bash environment files in a users home directory don't exist, it will revert back and use /etc/profile
 
Old 01-24-2007, 12:25 PM   #7
hard drive
LQ Newbie
 
Registered: Jan 2007
Posts: 1

Rep: Reputation: 0
the location of all the scripts gets moved around all the time in all the different distros, sometimes i have to go to like 3 files before i can set my shell shortcuts. grrr
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 02:34 PM
Bash Script- command on exit PDock Programming 6 12-23-2005 07:03 PM
what shell script runs only at bootup/startup pwhitey86 Mandriva 2 12-22-2004 10:13 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM


All times are GMT -5. The time now is 11:53 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration