[RHCE] echo ! in ~/.bashrc

Jeremy Portzer jeremyp at pobox.com
Tue Jun 29 09:54:35 EDT 2004


On Mon, 2004-06-28 at 22:22, somnath123s wrote:
> hey folks!!
> 
> i found the following statement in book:
> ========================================================================
> "Never put any command that may echo something to the screen in the
> ~/.bashrc file; such command belong in the ~/,bash_profile file only."
> ========================================================================
> 
> 
> 		why?
> 

~/.bashrc is run by all shells, including non-interactive ones.  This
can include shells that are started by shell scripts, shells being run
internally by numerous shell scripts within your system, etc.  The only
things you put in ~/.bashrc is "environment" changes (e.g., setting
variables, or other things like umask).  

~/.bash_profile on the other hand is only run by LOGIN shells, e.g.,
interactive ones.  It's okay to put things in here that echo to the
screen.  (Note that not all interactive shells are login shells; it
depends on how you start them.)

Hope this helps,

Jeremy Portzer, RHCE

-- 
/---------------------------------------------------------------------\
| Jeremy Portzer        jeremyp at pobox.com      trilug.org/~jeremy     |
| GPG Fingerprint: 712D 77C7 AB2D 2130 989F  E135 6F9F F7BC CC1A 7B92 |
\---------------------------------------------------------------------/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.trilug.org/pipermail/rhce/attachments/20040629/d1cfbc4c/attachment.bin


More information about the RHCE mailing list