[rhn-users] echo ! in ~/.bashrc
Corné Beerse
cbeerse at lycos.nl
Tue Jun 29 10:36:55 UTC 2004
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 called for every shell and hence the echo runs in every shell. This
includes all shell-scripts too. These used all over the place and hence can
cause strange behavoure. You can see that if you put the next line in your
~/.bashrc:
####
echo "This is ~/.bashrc, called from $0 at `date`" >> ~/.bashrc.log
####
It is the same with ~/.cshrc, however that causes less problems since the csh is
used less often in scripting.
Only scripts that use the -f option to start the shell ("#!/bin/bash -f" as
first line) donnot source ~/.bashrc and are not logged with the above line.
CBee
More information about the rhn-users
mailing list