From: Gamma <GammaFunction@vivaldi.net>
To: Lewis Butler <lbutler@covisp.net>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Paramater subsiution
Date: Sun, 27 Jun 2021 22:47:57 +0000 (UTC) [thread overview]
Message-ID: <b135aad4-af98-4f58-8ad7-36a16dbfdbf7@vivaldi.net> (raw)
In-Reply-To: <0CCFA5D7-9723-481E-9E20-D96E7F28D717@covisp.net>
Jun 27, 2021 17:42:48 Lewis Butler <lbutler@covisp.net>:
> Given:
>
> name="file 1234 - name"
> echo ${I% - name}
>
> I can easily get 'file', but how would I get "name" instead given that:
>
> o name and 1234 are variable lengths and values
> o "file" and " - " are constant across all the input
echo ${i##* - }
Removes the longest prefix ending with ' - '.
Check man zshexpn for more.
next prev parent reply other threads:[~2021-06-27 22:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-27 22:40 Lewis Butler
2021-06-27 22:47 ` Gamma [this message]
2021-06-28 5:34 ` Lawrence Velázquez
2021-06-28 22:33 ` Lewis Butler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b135aad4-af98-4f58-8ad7-36a16dbfdbf7@vivaldi.net \
--to=gammafunction@vivaldi.net \
--cc=lbutler@covisp.net \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).