is there a /bin/sh method to tell the ending of a file
John Levine
johnl at iecc.com
Mon Jan 7 22:14:34 PST 2008
>---------------------
>#!/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