[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Official position on POSIX compliance?



> I don't. I see no reason to not use extensions like test -a which are
> implemented in dash. Disallowing them adds no real benefit to the
> distribution and makes script harder to write.

1) test -a and -o are not required by POSIX and thus are not required in
   Debian /bin/sh

2) There are very simple alternatives (&& and ||) that are capable of
   substituting for every single -[ao] usage, and these are required by
   POSIX, required in Debian /bin/sh, and present in probably every
   Bourne-based shell on the planet.

3) test -a and -o have portability problems; see the Autoconf manual:
   http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_node/autoconf_122.html#IDX759


If everyone uses && and ||, we have cleaner, portable shell scripts.
The immediate practical benefits of this may be tenuous, but I see no
benefit in doing it the other way.  Then again, I don't see how
"test -f /tmp/blah && test -d /tmp/blah" is harder to write than
"test -f /tmp/blah -a -d /tmp/blah".



Reply to: