Re: Execution of subsequent commands after a command crashes.

Félix Hauri via Bug reports for the GNU Bourne Again SHell <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <[email protected]>
You missed a subshell test:

Le Mon, Feb 02, 2026 at 09:22:04PM +0800, 王伟 a écrit :
> #!/usr/bin/env bash
> ...
> { test_crash ; } || echo "case 4"

( test_crash ) || echo "case 5"

> 
> exit 0
> 

This one will work file as error will happen in a subprocess, and
after closing parenthesis, result code will be passed normally.


-- 
 Félix Hauri  -  <[email protected]>  -  http://www.f-hauri.ch
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.