zsh-users
 help / color / mirror / code / Atom feed
From: "Mark J. Reed" <markjreed@gmail.com>
To: "Lawrence Velázquez" <larryv@zsh.org>
Cc: zsh-users@zsh.org
Subject: Re: history puzzle
Date: Tue, 4 Jun 2024 16:37:54 -0400	[thread overview]
Message-ID: <CAA=-s3wmjg2-BStSv1x3XP6kpTy4kv9AsSwbtrzU1Hv_EDb0bw@mail.gmail.com> (raw)
In-Reply-To: <2603f68c-1e38-44a5-80e6-0bc6d3bb4d27@app.fastmail.com>

[-- Attachment #1: Type: text/plain, Size: 2190 bytes --]

What the . . . oh, I had *history* aliased for some reason, to *history -t
%FT%T 0*. Convenient when I type it by itself, but too late for *-m* by the
end of it; I so rarely use the command that I didn't notice I'd restricted
myself that way. Sorry for the added confusion.

(I replaced it with a function that only adds those arguments if I didn't
supply any already.)

I still think from Ray's mention of "words" that he was reading
documentation about history expansion rather than pattern-matching.

So, OK, *-m* option restricts the list of history entries printed out to
those matching the pattern. The argument is a glob pattern of the sort used
to match files, not a regular expression. Even if it were a regular
expression, though, *^ * and *$* would still match everything, since every
string has a beginning and an end. So I'm not clear what your goal was.

If you have *extendedglob* turned on, then *^ *is negation; *^foo* matches
anything that doesn't match *foo*, so *^* again matches everything. If you
don't have *extendedglob* turned on, it's not special at all, and *^* looks
for an entry exactly equal to nothing but "*^*".  And *$* is not special
either way, so that is again looking for an entry consisting of nothing but
a single dollar sign, and not surprisingly failing to find one.



On Tue, Jun 4, 2024 at 4:21 PM Lawrence Velázquez <larryv@zsh.org> wrote:

> On Tue, Jun 4, 2024, at 3:49 PM, Ray Andrews wrote:
> > On 2024-06-04 11:12, Mark J. Reed wrote:
> >> What's "history -m"? Doesn't that just look for items in the history
> >> containing "-m"?
> > The Devil!  Had that in my function for years, thought it meant 'pattern
> > following'.  Nuts, it works:
> >
> > 5 /aWorking/Zsh/Source/Wk 1 % history -rn "grep*" 1
> > fc: event not found: grep*
> >
> > 5 /aWorking/Zsh/Source/Wk 1 % history -rnm "grep*" 1
> > grep c52f */idProduct
> > grep c52f
> > grep c349 */idProduct
> > ...
> >
> > ... but I can't find it in the doc :(  A few examples would be so
> helpful.
>
> See the description of "fc" in zshbuiltins(1).  No examples, though.
>
> --
> vq
>
>

-- 
Mark J. Reed <markjreed@gmail.com>

[-- Attachment #2: Type: text/html, Size: 3062 bytes --]

  reply	other threads:[~2024-06-04 20:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 18:00 Ray Andrews
2024-06-04 18:12 ` Mark J. Reed
2024-06-04 19:28   ` Lawrence Velázquez
2024-06-04 19:52     ` Ray Andrews
2024-06-04 20:18       ` Lawrence Velázquez
2024-06-04 19:49   ` Ray Andrews
2024-06-04 20:19     ` Lawrence Velázquez
2024-06-04 20:37       ` Mark J. Reed [this message]
2024-06-04 23:51         ` Ray Andrews
2024-06-04 23:48       ` Ray Andrews
2024-06-05  0:33         ` Lawrence Velázquez
2024-06-05  2:00           ` Ray Andrews
2024-06-05 15:53             ` Mark J. Reed
2024-06-05 16:13               ` Ray Andrews
2024-06-04 18:54 ` Kannan Varadhan

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='CAA=-s3wmjg2-BStSv1x3XP6kpTy4kv9AsSwbtrzU1Hv_EDb0bw@mail.gmail.com' \
    --to=markjreed@gmail.com \
    --cc=larryv@zsh.org \
    --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).