From owner-freebsd-questions@FreeBSD.ORG Tue Jan 8 08:27:14 2008 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 68E5916A417 for ; Tue, 8 Jan 2008 08:27:14 +0000 (UTC) (envelope-from pprocacci@datapipe.com) Received: from fmailhost04.isp.att.net (fmailhost04.isp.att.net [204.127.217.104]) by mx1.freebsd.org (Postfix) with ESMTP id 5E9D613C455 for ; Tue, 8 Jan 2008 08:27:14 +0000 (UTC) (envelope-from pprocacci@datapipe.com) Received: from nat.myhome.net (adsl-157-61-28.bna.bellsouth.net[70.157.61.28]) by isp.att.net (frfwmhc04) with SMTP id <20080108082712H0400a63nhe>; Tue, 8 Jan 2008 08:27:13 +0000 X-Originating-IP: [70.157.61.28] Received: (qmail 27001 invoked from network); 8 Jan 2008 08:27:35 -0000 Received: from 2.21.5.10.in-addr.arpa (10.5.21.2) by 1.21.5.10.in-addr.arpa with QMQP; 8 Jan 2008 08:27:35 -0000 Date: Tue, 8 Jan 2008 02:27:29 -0600 From: Paul Procacci To: Gary Kline Message-ID: <20080108082729.GC95218@procacci.kicks-ass.org> References: <20080108051058.GA19698@thought.org> <20080108053408.GA95218@procacci.kicks-ass.org> <20080108074135.GC20085@thought.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080108074135.GC20085@thought.org> User-Agent: Mutt/1.4.2.3i Cc: FreeBSD Mailing List Subject: Re: is there a /bin/sh method to tell the ending of a file 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: Tue, 08 Jan 2008 08:27:14 -0000 On Mon, Jan 07, 2008 at 11:41:35PM -0800, Gary Kline wrote: > On Mon, Jan 07, 2008 at 11:34:08PM -0600, Paul Procacci wrote: > > Is this what you mean? > > > > --------------------- > > #!/bin/sh > > > > STRING="mystring.gz" > > > > if [ ".gz" = "`echo \"$STRING\" | sed -n 's/.*\(\.gz\)$/\1/p'`" ]; then > > echo test; > > fi > > > > ----------------------- > > > > ~Paul > > > > Sorry. You get the credit for the predicate expression; Jon had the > simpler > (and more readable:) one. But yours is warm+fuzzy in it's cleverness > :-) > > gary > > > > -- > Gary Kline Seattle BSD Users' Group (seabug) | kline@magnesium.net > Thought Unlimited Org's Alternate Email Site > http://www.magnesium.net/~kline > To live is not a necessity; but to live honorably...is a necessity. -Kant > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" Quite truthfully, I forget a lot about case/esac most of the time. It always seems to elude me. I guess it doesn't help that I'm a sed mongrel. And for what it's worth, I agree that what I provided wasn't pretty, but at least it gives everyone something to stare at for a while. ;P Have a good night all! ~Paul