From owner-freebsd-questions@FreeBSD.ORG Thu Oct 28 20:52:33 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37B591065694 for ; Thu, 28 Oct 2010 20:52:33 +0000 (UTC) (envelope-from sterling@camdensoftware.com) Received: from wh2.interactivevillages.com (wh2.interactivevillages.com [75.125.250.34]) by mx1.freebsd.org (Postfix) with ESMTP id F30928FC15 for ; Thu, 28 Oct 2010 20:52:32 +0000 (UTC) Received: from 174-21-106-233.tukw.qwest.net ([174.21.106.233] helo=_HOSTNAME_) by wh2.interactivevillages.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1PBZKE-0007OX-Vq for freebsd-questions@freebsd.org; Thu, 28 Oct 2010 13:43:56 -0700 Received: by _HOSTNAME_ (sSMTP sendmail emulation); Thu, 28 Oct 2010 13:52:27 -0700 Date: Thu, 28 Oct 2010 13:52:27 -0700 From: Chip Camden To: freebsd-questions@freebsd.org Message-ID: <20101028205227.GB45278@libertas.local.camdensoftware.com> Mail-Followup-To: freebsd-questions@freebsd.org References: <20101028160110.GA71713@guilt.hydra> <20101028194012.8117.qmail@joyce.lan> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rS8CxjVDS/+yyDmU" Content-Disposition: inline In-Reply-To: <20101028194012.8117.qmail@joyce.lan> User-Agent: Mutt/1.4.2.3i Company: Camden Software Consulting URL: http://camdensoftware.com X-PGP-Key: http://pgp.mit.edu:11371/pks/lookup?search=0xD6DBAF91 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - wh2.interactivevillages.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - camdensoftware.com Subject: Re: [OT] writing filters in sh X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 20:52:33 -0000 --rS8CxjVDS/+yyDmU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 >=20 > ---------------------------------------- > #!/bin/sh >=20 > cat "$@" |=20 > while read x > do > echo "I saw $x" > done > ---------------------------------------- >=20 > Sheesh. >=20 > 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-unsubscribe@freebsd.o= rg" Smacks forehead as if starring in a V-8 commercial=20 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 ) --=20 Sterling (Chip) Camden | sterling@camdensoftware.com | 2048D/3A978E4F http://camdensoftware.com | http://chipstips.com | http://chipsquips= .com --rS8CxjVDS/+yyDmU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQEcBAEBAgAGBQJMyeKLAAoJEIpckszW26+RA4EIAJfTVR1EdOfRa0dOkknuP13r bFpXEmhQVtavehozuUiYnDcFMW2DX5bFdL8L16xYZJ0bZIk5XXxqjKnFGkaq0MFF Blp0wnqZe5EwTk8w7/xLQ9z6hjGAwqqmN1vti1S6BCmvnuw8xcuR4EgAOwlCHfro 1lPK3MVuhIs28rvwq8A2gXR6xGTpIdAtJSJpDKRok5TKbcBsAQOFhId7XJUuSwYY sPR8+LwsFwqOHoerkTyML6uiatbCZAMez+9CWuJ/4RoavclhZANlnwo1L5NAHpfM f61hoGLQnS/OH36OOXtfmK7C6vlpn0d9ZGhxiIbqPgphL71dmuXeezIhsi9WjYU= =Hup6 -----END PGP SIGNATURE----- --rS8CxjVDS/+yyDmU--