is there a /bin/sh method to tell the ending of a file
pprocacci at datapipe.com
Tue Jan 8 00:27:14 PST 2008
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
> (and more readable:) one. But yours is warm+fuzzy in it's cleverness
> Gary Kline Seattle BSD Users' Group (seabug) | kline at magnesium.net
> Thought Unlimited Org's Alternate Email Site
> To live is not a necessity; but to live honorably...is a necessity. -Kant
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at 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!
More information about the freebsd-questions