2023年12月16日(土) 6:22 Giacomo Comes <gco...@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