3 ms·
Ah, thats great learned a new bash trick
by icefox 11y ago
Ah, thats great learned a new bash trick
- barrkel 11y agoShorthand for $(( )) is $[ ] In predicate contexts (which means return code in bash) like if, while or the left hand side of '&&', consider using (( )) - this has an exit code of 0 if the arithmetic expression is true (non-zero) and 1 otherwise. Use it like this: let x=3*3 if (( x > 5 )); then echo greater than five else echo less than or equal to five end