[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PW#5-10: System-wide environment variables used for program config



>>>>> "Kai" == Kai Henningsen <kaih@khms.westfalen.de> writes:

    > If program foo expects the environment variable
    > BAR=/var/lib/fubar, an easy way to make it comply to this policy
    > is to rename foo to foo-real, and write a wrapper shell script

    >            #! /bin/sh
    >            BAR=/var/lib/fubar foo-real "$@"

    > [I hope I got that right!]

    > NOTE: This may not work if the program decides what to do based
    > on the name it is called with. Fortunately, this is rare.

 Bash-2.0 `help exec' reads:

 exec: exec [-cl] [-a name] file [redirection ...]
    Exec FILE, replacing this shell with the specified program.
    If FILE is not specified, the redirections take effect in this
    shell.  If the first argument is `-l', then place a dash in the
    zeroth arg passed to FILE, as login does.  If the `-c' option
    is supplied, FILE is executed with a null environment.  The `-a'
    option means to make set argv[0] of the executed process to NAME.
    If the file cannot be executed and the shell is not interactive,
    then the shell exits, unless the shell option `execfail' is set.

 ... is the `-a' a POSIX feature?


Reply to: