New answers tagged variable-substitution
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 ...
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 ...
Top 50 recent answers are included
Related Tags
variable-substitution × 340bash × 196
shell-script × 89
shell × 60
variable × 53
zsh × 24
quoting × 24
command-substitution × 17
sed × 15
wildcards × 15
brace-expansion × 13
awk × 12
string × 12
command-line × 10
scripting × 10
environment-variables × 10
parameter × 10
ksh × 9
array × 9
grep × 8
find × 8
linux × 7
for × 7
function × 6
arguments × 6