Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11956

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: [POSIX] `a='a b'; export a=$a; echo $a` gives `a b` instead of `a`
Date 2015-12-05 19:26 -0500
Organization ITS, Case Western Reserve University
Message-ID <mailman.1493.1449361585.31583.bug-bash@gnu.org> (permalink)
References <566379E8.3040705@gmail.com>

Show all headers | View raw


-----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-----

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: [POSIX] `a='a b'; export a=$a; echo $a` gives `a b` instead of `a` Chet Ramey <chet.ramey@case.edu> - 2015-12-05 19:26 -0500

csiph-web