On Saturday, August 09, 2014 04:34:11 PM Jason Vas Dias wrote: > 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'; ) > $
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01 "If there is no command name, but the command contained a command substitution, the command shall complete with the exit status of the last command substitution performed. Otherwise, the command shall complete with a zero exit status." The declaration commands return the status of the command itself, which masks the status of assignments. To get the status, either perform the declaration and assignment separately, or use a temporary variable to store the status. For set -e the former is the only option. -- Dan Douglas