[Top][All Lists]

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

'declare' does not honor '-e' in command substituted assignments - a bug

From: Jason Vas Dias
Subject: 'declare' does not honor '-e' in command substituted assignments - a bug ?
Date: Sat, 9 Aug 2014 16:34:11 +0100

Good day bash list -

I don't understand why this emits any output  :
 $ ( set -e;  declare  v=$(false); echo 'Should not get here'; )
 Should not get here

While this does not:
 $ ( set -e;   v=$(false); echo 'Should not get here'; )

Shouldn't declare / typeset behave like the normal variable assignment statement
wrt command substitution ?  It does not seem to be documented anywhere if
it is not.

I'm using bash-4.3.18(1)-release ,  compiled from GIT under RHEL 6.4
for x86_64 - I've also tested the default RHEL 6.4 bash-4.1.2(1)-release and the
latest  4.3.22(1)-release with the same results.

Actually , this problem seems to apply to all built-ins -
 $ ( set -e ; echo $(false); echo 'not ok')

 not ok

I can't seem to find this behaviour documented anywhere . The same behaviour
happens in posix mode .

I'd appreciate an explanation as to why this behavior is not a bug .

Thanks & Regards,

Attachment: test_-e.sh
Description: Bourne shell script

reply via email to

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