#! -- reconsideration?

Charles Seeger seeger at cise.ufl.edu
Tue May 9 16:58:55 PDT 2000


+------ Daniel Quinlan wrote (Tue,  9-May-00, 14:31 -0700):
| 
| ... but what about an
| environment variable setting to set POSIX mode when using #!/bin/sh ?

I would prefer a command line option that could be added to the #! line
to specify the standard level required by the script.  Shells that
didn't recognize the option or didn't implement the specified standard
would decline to run the script.  The thought of a script changing
an environment variable in various places seems more dangerous than
necessary.

Another environment variable possibility (that I do NOT advocate) would
be one used by the script, rather than the interpreter, specifying an
absolute path to the posix shell.  The script would then have to include
a line at the top something like this abomination:

eval ${NoReExEc:-${POSIXSHELL:+'exec env NoReExEc=: $POSIXSHELL $0 "$@"'}}

Clearly, something like this is less than ideal.  8-)

However, the command line option superficially seems plausible.
What pitfalls are there with that option?

It would be nice to have simple mechanisms to both mitigate the need
for special install time configuration (e.g. /bin/sh -S xpg4) and to
facilitate that configuration (e.g. /bin/sh -V to report the shell's
implementation details).

Later,
Chuck




More information about the lsb-discuss mailing list