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

Re: Paramater subsiution



On 27 Jun 2021, at 16:47, Gamma <GammaFunction@xxxxxxxxxxx> wrote:
> 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##* - }

<thunks head on desk>

> Removes the longest prefix ending with ' - '.
> 
> Check man zshexpn for more.

I swear I knew that at one point, but missed it several times in reading the man page.

Thank you.

-- 
ɹןʇnqן
<mailto:lbutler@xxxxxxxxxx>
tel:+1.303.219.0564







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