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

Re: Notes on bash(1)



Jason Price <gt5076c@xxxxxxxxxxxxxx> writes:

> 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?

Personally, I use ## and %% operators for this:

	i=/usr/local/bin/mumble
	echo ${i##*/}

prints mumble.  This also works in bash and ksh.



Messages sorted by: Reverse Date, Date, Thread, Author