cron job verification
Michael ODonnell
michael.odonnell at comcast.net
Wed Feb 2 21:02:00 EST 2005
> If I'm not mistaken, If #!/bin/sh is used the shell will use
> what is set for the user variable $SHELL when a user logs in.
You're mistaken. The value of your $SHELL variable has
nothing to do with which interpreter handles a given
script when that script is directly "executed" by the
kernel. Linux perpetuates the classic UNIX behavior for
"Miscellaneous Interpreters" in this matter: if a file
is marked executable but is determined to NOT be a native
binary, the hash-bang directive (if found at the beginning
of the file) will be honored blindly.
So, if you put "#!/bin/sh" at the beginning of a script
and hope to execute it "directly" [eg. via exec()] there
had better be a /bin/sh in your filesystem because that's
the only interpreter that will be loaded for that script.
$SHELL comes into play in other situations, typically when
you're inside some other app and you want to execute an
arbitrary system command. In situations like that the
app in question will often honor your $SHELL variable and
attempt to use that to execute any command line you specify.
More information about the gnhlug-discuss
mailing list