does anybody use IFS in sh?

code 101 honey at down
Sat Jun 9 01:18:22 AEST 1984


i use IFS in my "path" command (sh version of "which"):

	#! /bin/sh
	IFS="${IFS}:"
	for arg do
		file=`basename ${arg}`
		for directory in $PATH; do
			if [ -x ${directory}/${file} ]; then
				echo ${directory}/${file}
			fi
		done
	done

'course i had to haq up test to use -x ...

once upon a time bourne and i bet a quarter on who could cons up a
better script for this ... i spent my winnings chomping inky, blinky,
pinky, and sue.  (he used sed -e 's/:/ /g' on $PATH.)
	peter honeyman



More information about the Comp.unix.wizards mailing list