-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 6/18/15 9:08 AM, Eric Blake wrote: > On 06/18/2015 06:51 AM, Chet Ramey wrote: > >> >> Neither of these are failures; the export command returns success. In >> fact, according to Posix, the export command cannot fail. > > Not quite true; export CAN fail: > http://austingroupbugs.net/view.php?id=351
Introducing declaration commands that treat arguments as assignments implies that these are variable assignment errors, not return status values from export. This interpretation doesn't change the description of export, which continues to list `zero' as the only possible exit status. > http://austingroupbugs.net/view.php?id=654 This applies to variable assignments preceding `export'. > such as when trying to modify a readonly variable: > > $ bash -c 'a=1; readonly a; export a=2; echo $?' > bash: a: readonly variable > 1 > > In fact, bash _didn't_ abort, while other shells do: You should have tried it in posix mode to test posix behavior. - -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlWC1BYACgkQu1hp8GTqdKvI8ACeIuzDSILRWu4tdVTj8Jqa05zN vp4An3AKEfU1mdC67ForbSKLWUdHU0IH =b45C -----END PGP SIGNATURE-----