is there a /bin/sh method to tell the ending of a file
Gary Kline
kline at magnesium.net
Mon Jan 7 23:40:20 PST 2008
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
More information about the freebsd-questions
mailing list