is there a /bin/sh method to tell the ending of a file
Paul Procacci
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
> simpler
> (and more readable:) one. But yours is warm+fuzzy in it's cleverness
> :-)
>
> gary
>
>
>
> --
> Gary Kline Seattle BSD Users' Group (seabug) | kline at 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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> 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!
~Paul
More information about the freebsd-questions
mailing list