zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Lewis Butler <lbutler@covisp.net>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Parameter subsitution
Date: Fri, 8 Jan 2021 14:25:46 -0800	[thread overview]
Message-ID: <CAH+w=7Yj+mgNGQsXoZn0JSWF-Gk7h=VUE3EnhiBv-kTF8uRzhA@mail.gmail.com> (raw)
In-Reply-To: <6B1D00CF-E282-49D3-8ABE-88AB8EBED62B@covisp.net>

On Fri, Jan 8, 2021 at 2:02 PM Lewis Butler <lbutler@covisp.net> 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!?


  reply	other threads:[~2021-01-08 22:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 22:02 Lewis Butler
2021-01-08 22:25 ` Bart Schaefer [this message]
2021-01-08 22:31   ` Lewis Butler
2021-01-08 22:53     ` Bart Schaefer
2021-01-08 23:46       ` Lewis Butler
2021-01-09  0:00         ` Lawrence Velázquez
2021-01-09  0:49           ` Bart Schaefer
2021-01-09  1:09           ` 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='CAH+w=7Yj+mgNGQsXoZn0JSWF-Gk7h=VUE3EnhiBv-kTF8uRzhA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --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).