command to strip suffix in .sh script

Anh Ky Huynh xkyanh at gmail.com
Thu Jun 3 16:11:38 UTC 2010


On Wed, 02 Jun 2010 20:25:36 -0400
Vinny <vinny-mail-01+freebsd20100602 at palaceofretention.ca> wrote:

> On 06/02/2010 04:30, Matthew Seaman wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On 02/06/2010 09:24:01, Matthias Apitz wrote:
> >> El día Wednesday, June 02, 2010 a las 04:15:22PM +0800, Aiza
> >> escribió:
> >>
> >>> I have this code
> [snip]
> >> $ echo 'archivename-201006021514.34.tar.gz' | sed 's/-.*$//'
> >
> > archive_name=${fromarchive%-*}
> >
> 
> Thanks Matthew, that's really neat.  It took me a long time
> to find the correct google incantation to find the documentation
> for that.  ( bourne shell pattern-matching notation )

In fact I know about that from Bash's documents:) IMHO, there are more Bash's documents than Bourne's ones.

Cheers,

-- 
Anh Ky Huynh


More information about the freebsd-questions mailing list