Date: Thu, 3 Jun 2010 10:00:32 -0700 From: George Davidovich <freebsd@optimis.net> To: freebsd-questions@freebsd.org Subject: Re: command to strip suffix in .sh script Message-ID: <20100603170032.GA95992@marvin.optimis.net> In-Reply-To: <20100603231116.5e1ef41f@icy.localdomain> References: <4C06131A.6010107@comclark.com> <20100602082401.GA2876@current.Sisis.de> <4C06169A.9090604@infracaninophile.co.uk> <4C06F680.1000608@palaceofretention.ca> <20100603231116.5e1ef41f@icy.localdomain>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 03, 2010 at 11:11:16PM +0700, Anh Ky Huynh wrote:
> On Wed, 02 Jun 2010 20:25:36 -0400 Vinny wrote:
> > On 06/02/2010 04:30, Matthew Seaman wrote:
> > > On 02/06/2010 09:24:01, Matthias Apitz wrote:
> > > > Aiza wrote:
> > > >
> > > > > 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.
Kids today. ;-)
No need for Magick Google Incantations:
man sh | less -p 'Parameter Expansion$'
man bash | less -p 'Parameter Expansion$'
--
George
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100603170032.GA95992>
