why doesn't this shell program work

SkinnerGF gfs at drutx.UUCP
Sat Mar 2 06:16:40 AEST 1985


..........
Here is a very simple program to print out your directories


variable=none
echo "directories"
for filename
in `ls`
do
	if test -d $filename
	then	variable=some
		echo $filename
	fi
done | pr -t4
echo $variable


HOWEVER, variable will always be none wheather or not anything
was found!  further debugging shows that variable = some before
exiting the pipe but, variable = none after exiting the pipe.
Why does the pipe do this?
Thanks in advance    .....    gary skinner   drutx!gfs



More information about the Comp.unix mailing list