Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Notes on bash(1)
- X-seq: zsh-users 1974
- From: Swen Thuemmler <swen@xxxxxxxxxxxxxxxx>
- To: Jason Price <gt5076c@xxxxxxxxxxxxxx>
- Subject: Re: Notes on bash(1)
- Date: Wed, 9 Dec 1998 18:17:51 +0100 (MET)
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <199812091619.LAA15213@xxxxxxxxxxxxxxxxxxxx>
- Sender: swen@xxxxxxxxxxxxxxxx
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author