Interesting Bourne shell usage - (nf)

rpw3 at fortune.UUCP rpw3 at fortune.UUCP
Thu May 31 18:06:10 AEST 1984


#R:utcsrgv:-436400:fortune:26900060:000:644
fortune!rpw3    May 30 21:10:00 1984

Inspired by the "pick" command in Kernighan & Pike's book, I tried:

	$ for i in `find . -name '*foo*' -print`
	> do echo -n "${i}? "
	> read ans
	> eval $ans
	> done

This allows you to execute a different command on each file found,
or execute a command that uses the file (referenced as $i) more
than once in the command (which find's -exec doesn't let you do).
Just <CR> if you don't want to do anything to one of them.

Hack, Hack... but useful when you need it.

Rob Warnock

UUCP:	{ihnp4,ucbvax!amd70,hpda,harpo,sri-unix,allegra}!fortune!rpw3
DDD:	(415)595-8444
USPS:	Fortune Systems Corp, 101 Twin Dolphin Drive, Redwood City, CA 94065



More information about the Comp.unix mailing list