On Apr 6, 2005 3:42 PM, Richard Chang richard@hinditron.com wrote:
Learning about .bash_profiles now. I would like to know how to apply environment variables edited or typed into the .bash_profile script without logging out and relogging in. Suppose I implement certain changes to the .bash_profile of a user( thru which I have currently logged in) and want to implement the changes without relogging in. How do we do it ? esp if we login thru X and edit it under x-term.
Thanks in advance for any help.
Richard
There are quite a few decent documentation on BASH programming. Get familiar with the Linux Documentation Project (www.tldp.org). Browse the HOW-TOs and indepth articles on BASH available at this site.
As for your query -
<shell prompt> $ exec bash
The above will replace your current shell with a "new" bash shell (with the same process - PID) that reads in all your .bash init files including .bash_profiles.
I would suggest that you put the changes in ~/.bashrc. This file is read each time a bash shell is spawned whereas .bash_profile is read only by the login shell.
Thus, in a X environment you will enjoy your latest and greatest changes in any new console type terminals you open.
If any X programs needs to use the "new" environment, you can launch them from the CLI of an xterm (or equiv.) if you do not want to logout of your x session (or you can launch a 2nd X session from a tty* console login - read the man pages for startx).
HTH -- Arun Khan