This is the first indication I've seen that perhaps bash 2.00 was being
used. Given this hint, I am able to reproduce Jason's problem by
connecting to a host which has bash 2.00 installed:
$ bash -c '((/usr/local/bin/rvplayer /tmp/foo); rm /tmp/foo) &'
bash: -c: line 1: missing closing `)' for arithmetic expression
bash: -c: line 1: syntax error near unexpected token `;'
bash: -c: line 1: `((/usr/local/bin/rvplayer /tmp/foo); rm /tmp/foo) &'
$
2.00 is, I gather, the first version of bash to implement the arithmetic
command, which has been in ksh for some time. ksh dislikes the command
line generated by Netscape too, though the error message is less clear:
$ ksh -c '((/usr/local/bin/rvplayer /tmp/foo); rm /tmp/foo) &'
ksh: syntax error at line 1 : `(' unmatched
$
With either shell, (( is a two-character token, which must be matched by
the two-character token )).
If Netscape didn't use ((, and instead used two left parens separated
by a space, there would be no problem (assuming existence of the program
and the data file, of course):
$ bash -c '( (/usr/local/bin/rvplayer /tmp/foo); rm /tmp/foo) &'
bash: /usr/local/bin/rvplayer: No such file or directory
$ /tmp/foo: No such file or directory
If I'm not mistaken, the arithmetic command is part of Posix 1003.2, so
it's not likely to go away. Here are a couple of examples of its use:
bash-2.00$ (( 2 + 2 ))
bash-2.00$ echo $?
0
bash-2.00$ (( 2 - 2 ))
bash-2.00$ echo $?
1
bash-2.00$
If the expression inside the (( ... )) evaluates to a non-zero value,
the command returns TRUE (zero result code). If the expression evaluates
to zero, the command returns FALSE (non-zero result code). The expression
can contain shell variables and any of an extensive set of operators.
Earlier versions of bash already had arithmetic expansion, by the way:
$ echo $(( 2 + 2 ))
4
What to do?
- Get the very latest version of Netscape, and see whether the problem
is still there.
- Replace /bin/sh, which is a symlink to /bin/bash, with the binary of
an older version of bash which does not implement the arithmetic
command. (No need to deprive yourself of 2.00 the rest of the time.)
- Replace /bin/sh with a script that checks for a -c option, and
replaces any ((s in the option value with ( (
-- ted@psg.com http://psg.com/~ted/ (Ted Powell) Promote Responsible Net Commerce: Fight Spam! http://spam.abuse.net/