Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Notes on bash(1)
- X-seq: zsh-users 1975
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Jason Price <gt5076c@xxxxxxxxxxxxxx>, zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: Notes on bash(1)
- Date: Wed, 9 Dec 1998 09:23:42 -0800
- In-reply-to: <199812091619.LAA15213@xxxxxxxxxxxxxxxxxxxx>
- References: <199812091619.LAA15213@xxxxxxxxxxxxxxxxxxxx>
On Dec 9, 11:19am, Jason Price wrote:
} Subject: Re: Notes on bash(1)
}
} 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?
${${anything::=/usr/local/bin/mumble}:t}
where "anything" is any variable name whose value you don't mind replacing
with the string "/usr/local/bin/mumble". E.g.:
zsh% echo ${${filename::=/usr/local/bin/mumble}:t}
mumble
zsh% echo $filename
/usr/local/bin/mumble
zsh%
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author