Pattern: Redundant (..)
around condition
Issue: -
You're wrapping (..)
around one or more condition. This is unnecessary, and the resulting fork adds overhead. Delete the surrounding (..)
since they serve no purpose and only slows the script down.
The shell syntax is if cmd
, elif cmd
, while cmd
and until cmd
without any parentheses. Parentheses are an independent construct used to create subshells.
Example of incorrect code:
if ([ "$x" -gt 0 ])
then true; fi
Example of correct code:
if [ "$x" -gt 0 ]
then true; fi