What is a good way to do general execs?

Guy Harris guy at auspex.auspex.com
Tue Jun 12 07:29:01 AEST 1990


>You might also want to adjust this a bit, so the user's .profile
>is not read into the shell [speeds up startup]:

Nope.  You must be assuming that a lot of "#! /bin/sh" headers have
"#! /bin/sh -" because the author didn't want ".profile" sourced,
presumably along lines similar to "#! /bin/csh -f".

That's not what the "-" does; it just makes sure that, if the name of
the script begins with "-" (e.g., because somebody's trying to break
your set-UID shell script - yes, there are other problems with set-UID
shell scripts, but...), the shell does *not* treat it as a flag
argument.  In that regard, it's similar to the "-b" flag in the C shell. 

The Bourne shell sources ".profile" *only* for login shells (just as the
C shell sources ".login" only for login shells - the "-f" in
"#! /bin/csh -bf" is there to prevent it from sourcing your ".cshrc").



More information about the Comp.unix.wizards mailing list