Date: Mon, 7 Jan 2008 23:34:08 -0600 From: Paul Procacci <pprocacci@datapipe.com> To: Gary Kline <kline@magnesium.net> Cc: FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG> Subject: Re: is there a /bin/sh method to tell the ending of a file Message-ID: <20080108053408.GA95218@procacci.kicks-ass.org> In-Reply-To: <20080108051058.GA19698@thought.org> References: <20080108051058.GA19698@thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 On Mon, Jan 07, 2008 at 09:10:58PM -0800, Gary Kline wrote: > Hi All, > > Is there an easy way of determing whether a string//filename ends in > *.gz? using /bin/sh? I spend around 20 minutes cobbling together > scripts to burn ISO files last night. Then blindly wasted one CD-R file that > was gzipped..... tar barfs on you,but cdrecord dev=foo.gz writes > exactly that. I'd like to add a line that yells at me, then gunzips and does > an MD5; then writes. (In C, no prob; C lets me fly, but not /bin/sh. > But anyway, if any guru can clue me in, thanks. I think my brain is in Maui > for a few days. > > tiam > > 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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080108053408.GA95218>