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
http://austingroupbugs.net/view.php?id=654

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:

$ dash -c 'a=1; readonly a; export a=2; echo $?'
dash: 1: export: a: is read only
$ ksh -c 'a=1; readonly a; export a=2; echo $?'
ksh: a: is read only

so that's arguably a bug in bash.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to