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 > _______________________________________________ > [email protected] mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "[email protected]"
<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 | [email protected] | 2048D/3A978E4F
http://camdensoftware.com | http://chipstips.com | http://chipsquips.com
pgpSZZpbI2Pws.pgp
Description: PGP signature
