bug-bash
[Top][All Lists]
Advanced

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

Re: export -p may output invalid variables


From: Chet Ramey
Subject: Re: export -p may output invalid variables
Date: Sat, 10 May 2008 22:28:54 -0400
User-agent: Thunderbird 2.0.0.14 (Macintosh/20080421)

Stephane Chazelas wrote:

Bash Version: 3.2
Patch Level: 33
Release Status: release

Description:
  ~$ env -i '1=a' sh -c 'export -p'
  export 1="a"
  export OLDPWD
  export PWD="/home/chazelas"
  export SHLVL="1"
  ~$ env -i '1=a' bash -c 'export -p'
  declare -x 1="a"
  declare -x OLDPWD
  declare -x PWD="/home/chazelas"
  declare -x SHLVL="1"
  ~$ env -i '1=a' sh -c 'export -p' | sh
  sh: line 1: export: `1=a': not a valid identifier
  ~$ env -i '1=a' bash -c 'export -p' | bash
  bash: line 1: declare: `1=a': not a valid identifier

Thanks for the report.  The right fix is to ignore words in the
environment that are not valid shell assignment statements.  Bash
already does this for words without an `=', for instance.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]