Hi,
> My local "checkbashisms" doesn't seem to complain at all. The
> [ ... ] syntax is
> just a shortcut for "test" and I would prefer to avoid it if
> possible. Could you
> check for me that using "test expr" wouldn't work in its place.
No, "test expr" doesn't work. After test you can only have arguments
to test, not shell expressions. It is possible of course to do:
if test `echo 2> /dev/null >> $PID_FILE; echo $?` -gt 0; then
For proof, see the man page: http://docs.sun.com/app/docs/doc/816-5165/test-1?l=en&q=man&a=view
> This seems reasonable, though checkbashisms doesn't report anything.
>
> I am wondering if your Solaris shell is POSIXly correct. Could you
> provide me
> with a pointer to its manual, please?
It doesn't get more POSIX than Solaris :).
$ /bin/sh
$ echo $(echo yes)
syntax error: `(' unexpected
Here is the man page. Note that the "Command substitution" section
doesn't mention anything about $() syntax.
http://docs.sun.com/app/docs/doc/816-5165/sh-1?l=en&q=man&a=view
cheers,
maarten
|