Skip to main content

New answers tagged

21 votes
Accepted

Why arithmetic syntax error in bash causes exit from the function?

POSIX requires that expansion errors exit non-interactive shells (and produce an error message). A syntax error upon arithmetic expansion is an expansion error When in POSIX mode like when ...
Stéphane Chazelas's user avatar
2 votes

Why arithmetic syntax error in bash causes exit from the function?

The problem is that you are using $a and $b inside the $(( … )) expression evaluator: c=$(($a - $b)) # Wrong (almost always) What's happening here is that $a and $b are evaluated as variables and ...
Chris Davies's user avatar

Top 50 recent answers are included