bug-bash
[Top][All Lists]
Advanced

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

Re: set-e and command expansion


From: Greg Wooledge
Subject: Re: set-e and command expansion
Date: Sun, 4 Feb 2024 13:11:25 -0500

On Sun, Feb 04, 2024 at 08:27:56PM +0300, Van de Bugger wrote:
> Case 3: echo $(false)
> 
> $ cat ./test  
> #!/bin/bash  
> set -e  
> echo before  
> echo $(false)  
> echo after
> 
> $ ./test  
> before
> 
> after
> 
> Oops, in this case the script is NOT terminated before "echo after", but
> continues to the end. I would say this is a bug, but interaction between "set 
> -
> e" and command substitution is not well defined in the bash manual.

I'm sure you can find explanations somewhere in the manual, after you
read it half a dozen times and then ask the Internet about the current
state of the POSIX standard and the current interpretation of how set -e
should work.  (It changes over time.)

Or... you could simply stop trying to understand it.  Dump it in the
rubbish bin of history where it belongs.

<https://mywiki.wooledge.org/BashFAQ/105> offers some more examples of
surprising behavior, along with explanations of each example.



reply via email to

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