bug-bash
[Top][All Lists]
Advanced

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

Re: issue with debug trap


From: Koichi Murase
Subject: Re: issue with debug trap
Date: Sat, 16 Dec 2023 09:42:50 +0900

2023年12月16日(土) 6:22 Giacomo Comes <gcomes@gmx.com>:

The original post asks the reason for the difference in the status
between the following two cases:

if ((0)); then :; else echo "here \$? is 1"; fi
if ((0)); then :; fi; echo "but here \$? is 0"

and the answer is that the former returns the status of ((0)) (which
is $? = 1), but the latter returns the status of the entire
if-statement (which is $? = 0 because no branch is selected. If any
branch was selected, it would've been the exit status of the last
command in the selected branch).

--
Koichi



reply via email to

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