} On Mon, Jan 07, 2008 at 09:10:58PM -0800, Gary Kline wrote:
} Paul Procacci <[EMAIL PROTECTED]>, said on Mon Jan 07, 2008 [11:34:08 PM]:
} > Hi All,
} > Is there an easy way of determing whether a string//filename ends in
} > *.gz? using /bin/sh? I spend around 20 minutes cobbling together
} > scripts to burn ISO files last night. Then blindly wasted one CD-R file
} > was gzipped..... tar barfs on you,but cdrecord dev=foo.gz writes
} > exactly that. I'd like to add a line that yells at me, then gunzips and
} > an MD5; then writes. (In C, no prob; C lets me fly, but not /bin/sh.
} > But anyway, if any guru can clue me in, thanks. I think my brain is in Maui
} > for a few days.
} Is this what you mean?
} if [ ".gz" = "`echo \"$STRING\" | sed -n 's/.*\(\.gz\)$/\1/p'`" ]; then
} echo test;
Works (I assume) but perhaps easier to read and more "native" might be:
case "$STRING" in
echo "Found .gz suffix"
echo "Not a .gz suffix"
Sh is a pretty versatile creature; I'm sure there are a thousand more ways
all of which work, and some of which will cause religious arguments for
email@example.com mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"