On Mon, Jan 07, 2008, 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

Another way might be

#!/bin/sh

# basename $filename .gz returns $filename unless it has a .gz
# suffix.
[ `basename $filename .gz` = $filename ] || {
        echo $filename has a .gz suffix
}

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

Intellectually, teachers fall between education theorists and bright
cocker spaniels. (Probably closer to the education theorists. The AKC has
been doing wonders with spaniels.) If you think I'm kidding look at the
GREs for education majors, whose scores are the lowest of all fields, and
remember that these are the smart ones. -- http://www.FredOnEverything.net
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to