cron job verification
Derek Martin
invalid at pizzashack.org
Wed Feb 2 14:02:01 EST 2005
On Wed, Feb 02, 2005 at 01:47:14PM -0500, Mark Komarinski wrote:
> > If you invoke bash as /bin/bash, it will source all your environment
> > files (usually just your .bashrc, since normally it won't be invoked
> > as a login shell in this manner). This can cause unintended effects.
>
> Based on systems I used to admin, it's best to have your .bashrc and .cshrc
> exit immediately if it isn't an interactive login. The reason we
> ran into was a user who wanted to scp a file, but it always failed.
You're right that this can be a problem, I've run into that one before
as well.
There is another solution to this problem, which is IMO better.
Sometimes, you want your bashrc to be sourced... I set a variety of
variables in my .bashrc that I would generally want scripts to know
about, including time zone and locale settings, for example.
To eliminate the problem you describe, I put login commands which
would generate output into .profile, and non-output-generating
commands in my .bashrc file.
Now, .profile is sourced when the shell is both interactive and a
login shell... otherwise .bashrc is sourced (see the bash man page,
INVOCATION section for specific details). In order to make sure the
stuff in .bashrc is sourced for interactive login shells, my .profile
explicitly sources it.
--
Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address. Replying to it will result in
undeliverable mail. Sorry for the inconvenience. Thank the spammers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20050202/8a2fadd0/attachment.bin
More information about the gnhlug-discuss
mailing list