Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Parameter subsitution
- X-seq: zsh-users 26353
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Lewis Butler <lbutler@xxxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Parameter subsitution
- Date: Fri, 8 Jan 2021 14:25:46 -0800
- Archived-at: <https://zsh.org/users/26353>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2021-01/CAH%2Bw%3D7Yj%2BmgNGQsXoZn0JSWF-Gk7h%3DVUE3EnhiBv-kTF8uRzhA%40mail.gmail.com>
- In-reply-to: <6B1D00CF-E282-49D3-8ABE-88AB8EBED62B@covisp.net>
- List-id: <zsh-users.zsh.org>
- References: <6B1D00CF-E282-49D3-8ABE-88AB8EBED62B@covisp.net>
On Fri, Jan 8, 2021 at 2:02 PM Lewis Butler <lbutler@xxxxxxxxxx> wrote:
>
> The s/l/r/ substitution works as follows.
> [. . . ]
> * A null l uses the previous string either from the previous l or from the contextual scan string s from ‘!?s’.
> * Note the same record of the last l and r is maintained across all forms of expansion.
>
> Does this mean that l is recorded until the shell terminates or until a new l is used?
Until a new l is used.
> Is there a way to see what the current l is set to?
No.
> $ file="/usr/local/tmp/filename.txt"
> $ echo ${file:s|e|3}
> /usr/local/tmp/fil3name.txt
> $ echo ${file:s||4}
> /usr/local/tmp/filename.txt
>
> Doesn't look like the l is maintained?
Works for me:
ubuntu% file=filename
ubuntu% print ${file:s/e/3}
fil3name
ubuntu% print ${file:s//4}
fil4name
ubuntu% print ${file:s||5}
fil5name
ubuntu%
> And where is the !?s syntax defined?
History expansion, under Event Designators.
> Any examples of using !?s in anger?
What are you talking about!?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author