Skip site navigation (1)Skip section navigation (2)
Date:      8 Jan 2008 05:47:53 -0000
From:      John Levine <johnl@iecc.com>
To:        freebsd-questions@freebsd.org
Cc:        pprocacci@datapipe.com
Subject:   Re: is there a /bin/sh method to tell the ending of a file
Message-ID:  <20080108054753.90411.qmail@simone.iecc.com>
In-Reply-To: <20080108053408.GA95218@procacci.kicks-ass.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>---------------------
>#!/bin/sh
>
>if [ ".gz" = "`echo \"$STRING\" | sed -n 's/.*\(\.gz\)$/\1/p'`" ]; then
> echo test;
>fi

Ewwww.  I think that we can now safely take advantage of
features added to the shell in the late 1970s.

-----------------------
#!/bin/sh

case "$1" in
 *.gz) echo that is a gzipped file ;;
 *) echo that is not a gzipped file ;;
esac

-----------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080108054753.90411.qmail>