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

Re: autotools



On Wed, Apr 25, 2007 at 01:13:14AM +1200, Volker Kuhlmann wrote:
> I have no old "authoritative" sh at hand, but a Solaris 2.7 /bin/sh
> spits a dummy on an empty item list. I view that as a dumb design (one
> would have to enclose for loops in a check for empty item lists), since
> corrected.

I don't have a copy of POSIX.2 (the shell stuff), so I have to refer to
the Single Unix Specification:

http://www.opengroup.org/onlinepubs/007908799/xcu/chap2.html#tag_001_009_004_002
============================================================================
for name [ in word ... ]
do
    compound-list
done

First, the list of words following in will be expanded to generate a list
of items. Then, the variable name will be set to each item, in turn,
and the compound-list executed each time. If no items result from the
expansion, the compound-list will not be executed.
============================================================================

You don't have to perform a separate check for an "empty item list".  This
is perfectly valid, and will do nothing:

  words=""
  for i in $words; do echo hello, world; done

If Solaris's shell is giving any output or errors from the commands above,
then it's crap.  (Which means autoconf would have to work around it.)

For Joerg: the fact that Solaris does NOT put its POSIX-compliant shell
in /bin/sh is a source of unending pain.  Since you can't use

  #!PATH=`getconf PATH`; sh

in a script, it's useless in real life.  Real scripts have to put SOMETHING
on the shebang line, and the only thing we can use is

  #!/bin/sh

Gods, how I wish POSIX had mandated something like "posix-shell"....



Reply to: