> >/usr/local/bin/bash test.sh
> test.sh: [: : integer expression expected
> force
>
> >/usr/local/bin/bash --posix test.sh
> test.sh: [: : integer expression expected
> force
>
> questions:
> - is there any reason for NOT substitute null values to 0 for integer
> expressions?
Because I don't believe it's the correct behavior for the arithmetic
comparison operators to `test'.
> - would be nice posix sh behave the same? (although posix does not =
> define a
> lot)
It's not really defined by posix. The korn shell and `posix' shells derived
from it perform arithmetic expansion on the operands of the arithmetic
operators, for instance, which posix says nothing about. (That's where the
the evaluation of "" as 0 comes from, by the way.)
> - why do we get the result force after errormsg?
Because the test command failed, and that branch of the `if' was taken.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live...Laugh...Love
Chet Ramey, ITS, CWRU chet@po.cwru.edu http://tiswww.tis.cwru.edu/~chet/