bug-bash
[Top][All Lists]
Advanced

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

Re: [POSIX] `a='a b'; export a=$a; echo $a` gives `a b` instead of `a`


From: Chet Ramey
Subject: Re: [POSIX] `a='a b'; export a=$a; echo $a` gives `a b` instead of `a`
Date: Sat, 5 Dec 2015 19:26:17 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/5/15 6:57 PM, Mingye Wang (Arthur2e5) wrote:
> Bash Version: 4.3
> Patch Level: 42
> Release Status: Release
> 
> Description:
>   According to [POSIX.1], `export` is special builtin *command*.
> Therefore as a command, in `a='a b'; export a=$a; echo $a`, `$a` should
> get split into words `a` and `b`.
> 
>   However, `bash` takes this as `export 'a=a b'` and gives un-POSIX
> results. To make sure this is not a `bash` extension since this is
> actually a common headache for new users and `bash` may try to extend
> its syntax here, I tried `bash --posix`, but it exhibits the same
> non-POSIX behavior.

This has come up before.  The current (amended) version of the Posix
standard  contains the following (approved) interpretation dating from
2010-2011:

http://austingroupbugs.net/view.php?id=351

which addresses exactly this case.

Bash is conformant, dash needs to be updated, or will be when this
amended version of the standard is published.

- -- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: GPGTools - http://gpgtools.org

iEYEARECAAYFAlZjgKEACgkQu1hp8GTqdKsK/ACgnzR6FE55Gyctqhsg/hyX3AIS
Xo8AmwRZmxKJhNo6KcQp5NqpSljio07a
=6FAj
-----END PGP SIGNATURE-----



reply via email to

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