Subject: Re: sh not expanding vars
To: None <tech-userlevel@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: tech-userlevel
Date: 10/01/2002 16:23:08
[ On Tuesday, October 1, 2002 at 20:50:14 (+0200), Julio Merino wrote: ]
> Subject: sh not expanding vars
> 
> Which is the correct behavior? ksh's or sh's one?

For both, I believe ksh is compliant with P1003.2a, but sh is not:

    PS1         Each time an interactive shell is ready to read a command,
                the value of this variable shall be subjected to parameter
                expansion and written to standard error.  The default
                value shall be "$ ".  For users who have specific
                additional implementation-defined privileges (see 2.2.2.6)
                the default may be another, implementation-defined, value.
                The shell shall replace each instance of the character !
                in PS1 with the history file number of the next command to
                be typed.  (See 5.12.)  Escaping the ! with another !
                (i.e., !!) shall place the literal character ! in the
                prompt.  This standard specifies the effects of this
                variable only for systems supporting the User Portability
                Utilities Option.

    ENV         This variable, when the shell is invoked, shall be
                subjected to parameter expansion (see 3.6.2) by the shell
                and the resulting value shall be used as a pathname of a
                file containing shell commands to execute in the current
                environment.  The file need not be executable.  If the
                expanded value of ENV is not an absolute pathname, the
                results are unspecified.  ENV shall be ignored if the
                user's real and effective user IDs or real and effective
                group IDs are different.  This standard specifies the
                effects of this variable only for systems supporting the
                User Portability Utilities Option.

The above paragraphs are from Draft#8 of P1003.2a, FYI.

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>