Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Notes on bash(1)



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