Path: utzoo!attcan!uunet!nems!ark1!uakari.primate.wisc.edu!samsung!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!hp4nl!phigate!ehviea!leo From: leo@ehviea.ine.philips.nl (Leo de Wit) Newsgroups: comp.unix.wizards Subject: Re: What is a good way to do general execs? Message-ID: <805@ehviea.ine.philips.nl> Date: 12 Jun 90 07:46:19 GMT References: <438@mtndew.UUCP> <347@exodus.Eng.Sun.COM> <3449@auspex.auspex.com> Reply-To: leo@ehviea.UUCP (Leo de Wit) Organization: Philips I&E Eindhoven Lines: 41 In article <3449@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: |>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"). Nope. For the man page for 'sh': Invocation. If the first character of argument zero is -, commands are read from $HOME/.profile, if such a file exists. In fact this documentation is not right either, since .profile is read (in the current directory instead of $HOME). Login shells are started with - prepended to the basename of their name as argv[0], so they will read $HOME/.profile. From the csh man page: Argument list processing If argument 0 to the shell is `-' then this is a login shell. What it should say: if argv[0] of the shell starts with a '-', it is treated as a login shell: $HOME/.login is sourced (cause that is what happens). Leo.