Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

another compatibility problem with sh



What's the relation between path and PATH when zsh is invoked as sh?
The following script breaks under zsh:

#! /bin/sh

SUPPORTED_FILTERS="\
	gs \
	dvips \
	MakeTeXPK \
	a2ps \
	ras2ps \
	"

FILTERS_FOUND=achei

if [ -f $FILTERS_FOUND ]; then
	: > $FILTERS_FOUND
fi

SEARCHPATH=`echo $PATH | sed -e "s/:/\ /g"`

for filter in $SUPPORTED_FILTERS
do
echo filter=$filter
	FILTER=`echo $filter | tr 'a-z' 'A-Z'`
echo FILTER=$FILTER
	for path in $SEARCHPATH
	do
		if [ -f $path/$filter ]
		then
			set HAVE_$FILTER="True" \
				&& echo "found filter $filter" \
				&& echo "HAVE_$FILTER=True" >> $FILTERS_FOUND
		fi
	done
done

The output is:

filter=gs
FILTER=GS
found filter gs
filter=dvips
./blah: command not found: tr [22]
FILTER=
found filter dvips
filter=MakeTeXPK
./blah: command not found: tr [22]
FILTER=

etc.

The problem is in the for variable "path". Changing it to something
else solves the problem. Is there a bug here?

Carlos




Messages sorted by: Reverse Date, Date, Thread, Author