zsh-users
 help / color / mirror / code / Atom feed
From: "Michael Barnes" <mibarnes@vt.edu>
To: zsh-users@math.gatech.edu
Subject: Re: Notes on bash(1)
Date: Wed, 9 Dec 1998 11:38:59 -0500	[thread overview]
Message-ID: <19981209113859.A21246@mibarnes.lib.vt.edu> (raw)
In-Reply-To: <199812091619.LAA15213@gypsy.cad.gatech.edu>; from Jason Price on Wed, Dec 09, 1998 at 11:19:27AM -0500

On Wed, Dec 09, 1998 at 11:19:27AM -0500, Jason Price wrote:
> >From zsh-workers:
> 
> (Quoting got screwed up... Sorry...)
> 
> Forwarded message:
> > > * ${parameter/pattern/string} and ${parameter//pattern/string}
> > >   pattern is expanded as per pathname expansion.  [munch]
> >
> > [munch]
> > Maybe it can be done quite simply by upgrading the extra flags Sven
> > added for # and % to match internal bits of a parameter's value.
> 
> there are a heck of a lot of ${...} modifiers that are wonderfully useful,
> but in my searching through the man pages, I havn't found an equivelent to
> basename /usr/local/bin/mumble -> mumble.  I need to pull the basename out
> of path strings quite offten, and I'd like to do so in shell.
> 
> Is this ... (wait, this is zsh) How can I do this?


~squid/logs foo=/usr/local/bin/mumble
~squid/logs echo $foo[(ws:/:)-1]      
mumble
~squid/logs foo=/usr/local/bin/mumble/
~squid/logs echo $foo[(ws:/:)-1]
mumble


This makes foo an array with the word separator `/' and gives the last
element in that array.

I am sure there are otherways to do this but this works for me.

Mike


  reply	other threads:[~1998-12-09 16:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-09 16:19 Jason Price
1998-12-09 16:38 ` Michael Barnes [this message]
1998-12-09 17:17 ` Swen Thuemmler
1998-12-09 17:23 ` Bart Schaefer
1998-12-09 17:44 ` Paul Lew
1998-12-10 10:45 ` Bruce Stephens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19981209113859.A21246@mibarnes.lib.vt.edu \
    --to=mibarnes@vt.edu \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).