[PLUG] Shell questions

Paul Heinlein heinlein at attbi.com
Wed Jun 5 15:10:44 UTC 2002


On Wed, 5 Jun 2002, Michael H.Collins wrote:

> ##########
> I have a couple .sh scripts that if I run out my shell (bash) runs
> fine, but if I put on the cron (crontab) it loses its env vars (like
> $SOMETHING), even calling su root -c myscript.sh on the crontab
> 
> What should I do to make sure my .sh scripts has the env vars? (on
> bash I actually call ". /etc/profile" to load them)
> ##########

Things to try:

1. Make sure the shebang line calls bash explicitly (i.e.,
   #!/bin/bash rather than #!/bin/sh)

2. Add --login to the shebang line: #!/bin/bash --login

3. Specify an rcfile: #!/bin/bash --rcfile $HOME/.profile

Pointing your colleague at the INVOCATION section of the bash(1) man 
page might be worthwhile.

--Paul Heinlein <heinlein at attbi.com>






More information about the PLUG mailing list