[parisc-linux] glibc build fails / bash bug

bame@riverrock.org bame@riverrock.org
Sun, 12 Nov 2000 13:27:32 -0700


= After a lot of digging, I *think* what is at fault is actually bash.

Bash has a bunch of 'set' options, some shell variables, and probably
some compile-time configure options, which affect its behavior, so I'd
compare all those.  One possibility is that the bash configure script on
hppa configures bash to be more like Posix, since that's what hp-ux shell
users expect.

The construct in question:

	echo "a b c
		1 2 3" | while read x1 x2 x3

*depends* on the way echo breaks or doesn't break lines, and the way
read parses them.  Often scripts like that also depend on whether
the shell actually makes a new subprocess for the 'while' or it doesn't,
because that determines whether variables set in the loop will still be
set on exit from the loop.  While I didn't find a way to make the
construction fail, a safer method (when you get a choice) is to use 'set':

	set -- a b c \
		1 2 3

	while [ $# != 0 ]
	do
	    echo $1 $2 $3
	    shift 3
	done

	-Paul "too much shell programming" Bame