Quoth John Levine on Thursday, 28 October 2010: > >I was hoping for a generalized, simple idiom for this, rather than > >needing to implement it myself, for demonstration purposes > > ---------------------------------------- > #!/bin/sh > > cat "$@" | > while read x > do > echo "I saw $x" > done > ---------------------------------------- > > Sheesh. > > R's, > John > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
<stage_direction>Smacks forehead as if starring in a V-8 commercial</stage_direction> And of course, if the script does input in more than one place, you can enclose the entire section in parentheses after the pipe: cat "$@" | ( read x ... read y ... select ans in a b c; do break; done ) -- Sterling (Chip) Camden | sterl...@camdensoftware.com | 2048D/3A978E4F http://camdensoftware.com | http://chipstips.com | http://chipsquips.com
pgpSZZpbI2Pws.pgp
Description: PGP signature