Date:        Tue, 3 Feb 2026 10:13:06 +0800
    From:        =?UTF-8?B?546L5Lyf?= <[email protected]>
    Message-ID:  
<capgy_banuxjaarleyhrureaudd3qxkps4zyoskxx6j6324w...@mail.gmail.com>


  | The second method above also won't work. Isn't the purpose of a semicolon
  | to create a new line? Does it have some other side effect?

Yes, the shell parses the entire command, until it has finished, and
a newline appears - if there's a shell detected error, the entire
parsed command is aborted.

In the case

        test_crash
        if ...

the "test_crash" will be parsed and executed (and fail), then the
shell will read the if (all of it) and execute that.

In
        test_crash; anything_else

the shell will read and parse all of that (to the end of anything_else)
and then execute it.   test_trash aborts with a shell error, nothing
else is executed.

kre

ps: it is really dumb to use bash extensions when standard portable
POSIX shell code works equally well, "[[ $? -ne 0 ]]" is not in the
slightest different from "[ $? -ne 0 ]" and the latter will work in
any shell - so use the latter, not the former.   This of course makes
absolutely no difference to the point of these messages.



Reply via email to