Re: shell



Stephane Chazelas <stephane_chazelas@xxxxxxxx> wrote, on Wed, 22 Mar 2006:

# ensure `Unix' utilities
PATH=$(command -p getconf PATH; :):$PATH
export PATH

Unfortunately this method has a chicken-and-egg problem.
The output from "command -p getconf PATH" can vary depending on
whether you are running it in a conforming environment or not
(or in which conforming environment, if the system supports
multiple versions of the standard concurrently).

For example on Solaris 10, you only get the SUSv3 PATH out if
you already have PATH set to find the SUSv3 utilities before
the SUSv2 ones:

$ type sh
sh is a tracked alias for /usr/xpg4/bin/sh
$ sh -c 'PATH=/bin; command -p getconf PATH'
/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
$ sh -c 'PATH=/usr/xpg6/bin:/usr/xpg4/bin:/bin; command -p getconf PATH'
/usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin

--
Geoff Clare <netnews@xxxxxxxxxxxxx>

.



Relevant Pages

  • Re: shell
    ... The output from "command -p getconf PATH" can vary depending on ... whether you are running it in a conforming environment or not ... a PATH set for SUSv3 it changes it to one set for SUSv2. ...
    (comp.unix.questions)
  • Re: shell
    ... The output from "command -p getconf PATH" can vary depending on ... whether you are running it in a conforming environment or not ... you already have PATH set to find the SUSv3 utilities before ...
    (comp.unix.questions)
  • Re: shell
    ... command -p getconf PATH' ... As far as the standard is concerned, ... Utilities are only required to behave as described in the standard ... if they are executed in a "conforming environment" (which includes ...
    (comp.unix.questions)