Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: removing spaces in variables when using :t or :r or similar
- X-seq: zsh-users 23620
- From: TJ Luoma <luomat@xxxxxxxxx>
- To: agkozak@xxxxxxxxx
- Subject: Re: removing spaces in variables when using :t or :r or similar
- Date: Wed, 12 Sep 2018 01:07:55 -0400
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=j1qCKf3CVUc7Jk8n1EiuVYGe67Km0zCdVfaX4FiofH8=; b=QNOmgISYI3PcdbcWvxKYNWar2gxeoUscKL9bqTajJsDd8lJ6X8ZVFDC+Fja4qcRrOC ZUmIW/0gpJDEiGdEaR4Da1nnQtoOwEr78Q/m7eerbFuBFEITW5O1eot7Q8Rr5YaxmyP3 2H5bIu73EOWqLnzGrtPZKadYNfV8UjmZTUcRdJAaAtwiDagWg/RfbmOWCeD92NQjpziG O2P7AodFKju/t/GXCNG39oR1IHFNoBuz+pORHSFgivE1jK5YXDBqgTnGziwWDNIX7YqD tO3pA8J6ipsTc1myIPIIf/6LolYed3jYiJgYcU83tcDiWjE6CorUsgQCF5Nn3usv+xT+ LsEg==
- In-reply-to: <006401d44a38$dd948870$98bd9950$@gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CADjGqHvZESTxjvAAiiSp34i4nk=c+pL=pNiDqEWBHoM2YMouDA@mail.gmail.com> <006401d44a38$dd948870$98bd9950$@gmail.com>
Aha! I had tried extra quotes and {brackets} but I never hit upon the right
combination.
Thanks!
Tj
--
TJ Luoma
TJ @ MacStories <http://www.macstories.net/author/tjluoma/>
Personal Website: luo.ma <http://luo.ma/> (aka RhymesWithDiploma.com
<http://rhymeswithdiploma.com/>)
Twitter: @tjluoma <http://twitter.com/tjluoma>
On Tue, Sep 11, 2018 at 9:35 PM Alexandros Kozak <agkozak@xxxxxxxxx> wrote:
> ${${INSTALL_TO:t:r:l}// /}
>
> seems to work.
>
>
> Alexandros Kozak
>
> -----Original Message-----
> From: TJ Luoma <luomat@xxxxxxxxx>
> Sent: Tuesday, September 11, 2018 6:28 PM
> To: Zsh-Users List <zsh-users@xxxxxxx>
> Subject: 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