10.7 Parentheses in Shell Scripts
Beware of two opening parentheses in a row, as some shell
implementations mishandle them. For 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 Shell Substitutions.
Posix requires support for case patterns with opening
parentheses like this:
case $file_name in
(*.c) echo "C source code";;
esac
but the ( in this example is not portable to many older Bourne
shell implementations. It can be omitted safely.
|