Email List: Xaustin-group-lX
[All Lists]

Invalid shell assignments in environment

To: austin-group-l@xxxxxxxxxxxxx
Subject: Invalid shell assignments in environment
From: Chet Ramey <chet.ramey@xxxxxxxx>
Date: Tue, 30 Jun 2009 22:01:57 -0400
Cc: chet.ramey@xxxxxxxx, Geoff Clare <gwc@xxxxxxxxxxxxx>
Organization: ITS, Case Western Reserve University
What should the shell do with environment strings that are not valid
shell assignment statements?  The question came up about environment
variable names containing characters outside the set permissible for
shell variable names, but it could also apply to environment strings
like `a' or `=a'.

For instance, what should the following print?

env foo@bar=baz sh -c 'export | grep "^foo@" ; echo between; printenv |
grep "^foo@"'

bash-4.0 doesn't pass these names onto child processes in the export
environment; bash-3.2 did.  ksh93 before ksh93s does not pass them.
The Bourne shell never has.  Most hells derived from ash pass them
along (the FreeBSD sh even creates a shell variable named "foo@bar");
most shells derived from pdksh do not.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/

<Prev in Thread] Current Thread [Next in Thread>