Date: Mon, 7 Jan 2008 23:41:35 -0800 From: Gary Kline <kline@magnesium.net> To: Paul Procacci <pprocacci@datapipe.com> Cc: Gary Kline <kline@magnesium.net>, FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG> Subject: Re: is there a /bin/sh method to tell the ending of a file Message-ID: <20080108074135.GC20085@thought.org> In-Reply-To: <20080108053408.GA95218@procacci.kicks-ass.org> References: <20080108051058.GA19698@thought.org> <20080108053408.GA95218@procacci.kicks-ass.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080108074135.GC20085>