From owner-freebsd-questions@FreeBSD.ORG Tue Jan 8 07:40:20 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 AEC2816A418 for ; Tue, 8 Jan 2008 07:40:20 +0000 (UTC) (envelope-from kline@magnesium.net) Received: from toxic.magnesium.net (toxic.magnesium.net [207.154.84.15]) by mx1.freebsd.org (Postfix) with ESMTP id A696513C447 for ; Tue, 8 Jan 2008 07:40:20 +0000 (UTC) (envelope-from kline@magnesium.net) Received: by toxic.magnesium.net (Postfix, from userid 1070) id 7DE54DA831; Mon, 7 Jan 2008 23:41:35 -0800 (PST) Date: Mon, 7 Jan 2008 23:41:35 -0800 From: Gary Kline To: Paul Procacci Message-ID: <20080108074135.GC20085@thought.org> References: <20080108051058.GA19698@thought.org> <20080108053408.GA95218@procacci.kicks-ass.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080108053408.GA95218@procacci.kicks-ass.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: Gary Kline , 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 07:40:20 -0000 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