I came across this question whose author had dealt with problem caused by:
let x=1-1
exits with code 1.
According to bash manual:
If the last expression evaluates to 0, let returns 1; otherwise 0 is returned. (p. 56-57)
I'm not so familiar with bash nuances, so my question is "What is the reason of such behaviour?". May be that's because 0 interprets like 'false'? It's a bit strange for bash-beginner like me that 0 as a result of arithmetic expression leads to an error exit code...
let ...
can be used as logical expression forif
,while
etc. Am I right? – Alexander Blazhkov Oct 04 '21 at 17:09