From owner-freebsd-chat Thu Sep 10 17:33:07 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA06172 for freebsd-chat-outgoing; Thu, 10 Sep 1998 17:33:07 -0700 (PDT) (envelope-from owner-freebsd-chat@FreeBSD.ORG) Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA06165 for ; Thu, 10 Sep 1998 17:33:03 -0700 (PDT) (envelope-from grog@freebie.lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.9.1/8.9.0) with ESMTP id JAA03206; Fri, 11 Sep 1998 09:44:56 +0930 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.9.1/8.9.0) id JAA13706; Fri, 11 Sep 1998 09:44:46 +0930 (CST) Message-ID: <19980911094445.X583@freebie.lemis.com> Date: Fri, 11 Sep 1998 09:44:45 +0930 From: Greg Lehey To: =?iso-8859-1?Q?Dag-Erling_Co=EFdanSm=F8rgrav?= Cc: Wes Peters , "Jordan K. Hubbard" , freebsd-chat@FreeBSD.ORG Subject: Re: ed References: <9698.905291210@time.cdrom.com> <35F7CF17.E0C82BCA@softweyr.com> <19980911085119.L583@freebie.lemis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 0.91.1i In-Reply-To: =?iso-8859-1?Q?=3Cxzp67evfrq2=2Efsf=40hrotti=2Eifi=2Euio=2Eno=3E=3B_from?= =?iso-8859-1?Q?_Dag-Erling_Co=EFdanSm=F8rgrav__on_Fri=2C_Sep_11=2C_1998_?= =?iso-8859-1?Q?at_01:55:17AM_+0200?= WWW-Home-Page: http://www.lemis.com/~grog Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Friday, 11 September 1998 at 1:55:17 +0200, Dag-Erling CoïdanSmørgrav wrote: > Greg Lehey writes: >> So what's wrong with >> >> for file in `find . \( -name '*.[ch] -o -name Makefile \) -print` >> do >> sed file.new 's/Good Time Engineering/Mega Baby Bell/g' >> if [ $? -eq 0 ]; then >> mv file.new >> fi >> echo $file edited. >> done > > Well, you forgot a few ' and $ here and there, it will barf at the > first mv for want of a second argument, Guess who wrote in a hurry and didn't test :-( But where did I miss a '? Bill's missed ' doesn't count. > and it can be written more concisely (and more readably): > > for f in `find . \( -name '*.[ch]' -o -name Makefile \)` ; do > sed 's/Good Time Engineering/Mega Baby Bell/g' "${f}" >"${f}.new" && > mv "${f}.new" "${f}" && echo "edited ${f}" > done Style considerations. > Apart from that, nothing :) I'm glad to see you accept it :-) Greg -- See complete headers for address, home page and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message