is there a /bin/sh method to tell the ending of a file
Paul Procacci
pprocacci at datapipe.com
Mon Jan 7 21:53:16 PST 2008
/Gulp
Guess I'm too `new` skool! ;-P
Cheers!
On Tue, Jan 08, 2008 at 12:47:53AM -0500, John Levine wrote:
> >---------------------
> >#!/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
>
> -----------------------
More information about the freebsd-questions
mailing list