From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4286 invoked from network); 9 Dec 1998 17:21:22 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 9 Dec 1998 17:21:22 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id MAA28658; Wed, 9 Dec 1998 12:19:30 -0500 (EST) Resent-Date: Wed, 9 Dec 1998 12:19:23 -0500 (EST) Date: Wed, 9 Dec 1998 18:17:51 +0100 (MET) From: Swen Thuemmler Sender: swen@uni-paderborn.de To: Jason Price cc: zsh-users@math.gatech.edu Subject: Re: Notes on bash(1) In-Reply-To: <199812091619.LAA15213@gypsy.cad.gatech.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Resent-Message-ID: <"YhddG3.0.5_6.Q4hRs"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1974 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Wed, 9 Dec 1998, Jason Price wrote: > 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? Well, it is in the info-pages, section on modifiers. Excerpt: `h' Remove a trailing pathname component, leaving the head. `r' Remove a trailing suffix of the form ``.'XXX', leaving the basename. `e' Remove all but the suffix. `t' Remove all leading pathname components, leaving the tail. [...] So: swen@kreta <~>: foo=/usr/local/bin/mumble swen@kreta <~>: echo ${foo:t} mumble swen@kreta <~>: Hope this helps. --Swen