(autoconf.info)Parentheses


Next: Slashes Prev: Assignments Up: Portable Shell

10.8 Parentheses in Shell Scripts
=================================

Beware of two opening parentheses in a row, as many shell
implementations treat them specially.  Posix requires that the command
`((cat))' must behave like `(cat)', but many shells, including Bash and
the Korn shell, treat `((cat))' as an arithmetic expression equivalent
to `let "cat"', and may or may not report an error when they detect
that `cat' is not a number.  As another example, `pdksh' 5.2.14
misparses the following code:

     if ((true) || false); then
       echo ok
     fi

To work around this problem, insert a space between the two opening
parentheses.  There is a similar problem and workaround with `$(('; see
Note: Shell Substitutions.


automatically generated by info2www