Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Paramater subsiution
- X-seq: zsh-users 26782
- From: Gamma <GammaFunction@xxxxxxxxxxx>
- To: Lewis Butler <lbutler@xxxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Paramater subsiution
- Date: Sun, 27 Jun 2021 22:47:57 +0000 (UTC)
- Archived-at: <https://zsh.org/users/26782>
- Dkim-filter: OpenDKIM Filter v2.11.0 smtp.vivaldi.net A335CBD021
- Dkim-filter: OpenDKIM Filter v2.11.0 smtp.vivaldi.net 41789BD063
- In-reply-to: <0CCFA5D7-9723-481E-9E20-D96E7F28D717@covisp.net>
- List-id: <zsh-users.zsh.org>
- References: <0CCFA5D7-9723-481E-9E20-D96E7F28D717@covisp.net>
Jun 27, 2021 17:42:48 Lewis Butler <lbutler@xxxxxxxxxx>:
> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author