-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC1076
Vidar Holen edited this page Oct 20, 2022
·
1 revision
[ i / 2 + 7 -ge 18 ]
[ $((i / 2 + 7)) -ge 18 ]
ShellCheck found a loose +*/%
in a test statement. This usually happens when trying to do arithmetic in a condition, but without using the arithmetic expansion construct $((expression))
.
In C, if (a+b == c)
is perfectly fine, but in sh this must be written to first expand the arithmetic operation like if [ $((a+b)) = c ]
.
None.
- Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!