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

removing spaces in variables when using :t or :r or similar



Let's use this variable as an example:

INSTALL_TO='/Applications/Keyboard Maestro.app'

Now, if I want to get just "keyboard maestro" I can use this:

$INSTALL_TO:t:r:l

But what if I want "keyboardmaestro" ?

I tried this:

echo "${INSTALL_TO:t:r:l// /}"

but that just produced this error:

zsh: unrecognized modifier

I realize I could do this:

FOO="${INSTALL_TO// /}"

echo "$FOO:t:r:l"

but I'd rather avoid using a second variable, if I can avoid it.

Is there a way to do that with zsh, or am I stuck just sending it to `tr -d
' '` ?

Thanks!

TjL

--
TJ Luoma
TJ @ MacStories
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Twitter: @tjluoma


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