From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 7EBF329DA6 for ; Tue, 4 Jun 2024 22:38:50 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1717533530; b=M8hrfmoUdCwdJbYRgLbm4Qd/l80X8tHDKoxCrmDME/8FNPmBqImhdm5U2xW9QkJRb0HYTxJFGH n9RdM5TugjtnTg1HFrXFlOt6cI2IZdOCaTLVSB33d8DsulBNoMEsRoXWCINte/iznxi/t+KfQ8 RQISBFZuRW/PFsv1VcD6I9tuIs1lqKjNv6E9IInYmGKHGuvSX/iU0G1m0QKxbOV5C1CKMkt4bG MCuBxnkwUPtSjdW77ckIx9FaZ3LeWsTOLEvEwZvTNXafbNzQo3yC4rcq7bSNyu3+5NHZ+ta3Qw BJw4Nefd5rv+Z0yJgPNAN5+DwdiD1jB5+9icXxUmoXtYyw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1717533530; bh=tZBamujonWmw5lNm0TMXoj8w8iMvDmJZK6K9cd4RzXI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=XyqVJMz3VK660YbKUhl2dRJzvgnD23pyzbV6Si5H3yoL7xSCPTy2iee19axs3oFU+BVSQAEadF M951rPOJSXLY7aQTI7tFND4HsiqB3/Tep1c0BHgbBIFguVI6ewSygHVNXAmb2Aeo1tnVKQJ/bb 1XdKBJyhQ1VNYK2237IqxI0+fNHfvv5NTrcee4WtlwtmikUkx4vCLMPueFNKi85DTs+8L/il0b RXkpkkWkKHoaHI35rZ1Ti8M4jQ+pVtissLP2eVvGLvgcdToUg5J2FJmkHT0jKaL1EaAPwLzHWn ZPKssOnnA2CpKDPs1Ule4aFusnzVymL34gukOvmu/CgQrQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=4wPHLIhn9BnH2Cb9D8u0phEcewpcgcV8TtzfJEzvuRs=; b=ZDHM8UUG8RZwnua84fiIH9/NxA hEEyLAkadlYz3Fg8Xl+lRypVzpc/W61r4kqHsHUmYbZn+70YL/YNCFU7V+/Bkg610ExsslD7LE5zJ VQJpYwnVBcUQoBXcbNvefp4F6YCQ/Rl7ONO9vQ1/N9i0R/2aiG1ZXkwxRdf6G3qlxLHzBDevjsRkV JjV12bSYplKLlEIcXv5ozOUoezkXrqEX5UmTjkRPBCZqdSCWg2vKXC8x7fjKWN0+n1CHKmKLpUJS4 Y2hewJ43kudlX7IQZREytGQ3pzcfLB41xhLWH6z6KB6+yGiT26Iu7WuRVtsIxoC2Pq44561Zv62Vo HNuiJNTg==; Received: by zero.zsh.org with local id 1sEavh-0005za-WF; Tue, 04 Jun 2024 20:38:50 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f176.google.com ([209.85.208.176]:52462) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1sEav3-0005Ga-GZ; Tue, 04 Jun 2024 20:38:09 +0000 Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2eaae2a6dc1so49370221fa.0; Tue, 04 Jun 2024 13:38:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717533488; x=1718138288; darn=zsh.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4wPHLIhn9BnH2Cb9D8u0phEcewpcgcV8TtzfJEzvuRs=; b=Pz+XJMgNdJi+2CZU1Kh49Vvt9gVELTipXF9ycs4ADAMSq708ljay75d4JHj/5ssnBN VayRgq72feWEGwdDO6pXr2Wb+PR+FTm4653VTIGVMCC6ujf/4VM5G8kDVSFrqD+Legmn bcTqaHRd0GQ+1jVXqaZKEEPSxnN3EA+e2Pz4gcRUbw+ZrghVrPyoQEl8VjgaR17ZdzZs vt0AA/GUh9vT8L3Z9oLoQigSK2gJUeHotHVwqa9nkHOXb56vEnuneScDcy2UbsfNmh/9 Q4+1axL8InibMnCn89XdNLftpp/K2mHkg1nJ6a8frNJkiQtaIpv1UZRjiQtt1F8LUvze GaZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717533488; x=1718138288; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4wPHLIhn9BnH2Cb9D8u0phEcewpcgcV8TtzfJEzvuRs=; b=it5Wvlm0CNhWl5iYCrorOVDDtrNz9o2ICxEk5kFM82pocxztGBZGac2IZ9yHKLfsUC LvyQ6A7ip3R6wMlQleYxYAYAdyBDnImcbsO+BmnlTTgCrHARel1rUaCBmVYuhMq4cuLz zf1k5EPtiCeeFAkEYCz+yYjgcw2EgAPsLEHeifwmwKDZXn000xlkaYsiJP9f0fl1z7cH RSNBFjdkC2aiOYUVE+2aG5LOG7bJT1KkDhW8hbFKsWDHMUgdZzfBrbgnEa+9L1/3QmQl GSGmbHqkLkIhfIHwYCaMUdn60n0nQ8cPspp9/wVtRDrsUY6e/8R2yLRDcdAN5tXUKfAe dLWg== X-Gm-Message-State: AOJu0YwhASkqX+yMfV9HeTk7E7i41rsjQaG1oV9rgN78y9ULW8556zid fGiw8hMgMFfix8lyv8kGYn6uhPa9lGqQNr6IBfFuA6ZuW7w8Ooq/thucD8OXt+j1yVAZ4MSiFPn XoDEMG8jZn0j3b6VY5L6tQkbv1MaRbchN X-Google-Smtp-Source: AGHT+IGOEG/xcRBpmmkg9wT+LaAJhICgq336l2/JsytzKIQ4rz3v/QW8HaYS7ZxXe/KHt1R9OzLpgFY1IrNb8Jja0eo= X-Received: by 2002:a2e:3008:0:b0:2ea:82e4:5812 with SMTP id 38308e7fff4ca-2eac79c8a28mr2630911fa.29.1717533487843; Tue, 04 Jun 2024 13:38:07 -0700 (PDT) MIME-Version: 1.0 References: <32c690d4-fe7f-4d89-ac99-829fa64cca15@eastlink.ca> <81576af9-80b3-4bcd-b23b-c0d67cff1870@eastlink.ca> <2603f68c-1e38-44a5-80e6-0bc6d3bb4d27@app.fastmail.com> In-Reply-To: <2603f68c-1e38-44a5-80e6-0bc6d3bb4d27@app.fastmail.com> From: "Mark J. Reed" Date: Tue, 4 Jun 2024 16:37:54 -0400 Message-ID: Subject: Re: history puzzle To: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="0000000000006ed38c061a166d5e" X-Seq: 30004 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --0000000000006ed38c061a166d5e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=AFPM Lawrence Vel=C3=A1zquez 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 'patter= n > > 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 > > --=20 Mark J. Reed --0000000000006ed38c061a166d5e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
What the . . . oh, I had history aliased for some r= eason, to history -t %FT%T 0. Convenient when I type it by itself, b= ut too late for -m=C2=A0by the end of it; I so rarely use the comman= d that I didn't notice I'd restricted myself that way. Sorry for th= e added confusion.=C2=A0

(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-ma= tching.

So, OK, -m=C2=A0option restricts th= e list of history entries printed out to those matching the pattern. The ar= gument is=C2=A0a glob pattern of the sort used to match files, not a regula= r expression. Even if it were a regular expression, though, ^=C2=A0= =C2=A0and $=C2=A0would still match everything, since every string ha= s a beginning and an end. So I'm not clear what your goal was.

If you have extendedglob=C2=A0turned on, then ^ = is negation; ^foo=C2=A0matches anything that doesn't match <= b>foo, so ^=C2=A0again matches everything.=C2=A0If you don't= have extendedglob=C2=A0turned on, it's not special at all, and = ^=C2=A0looks for an entry exactly equal to nothing but "^".=C2=A0 And $=C2=A0is not special either way, so that is agai= n 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=E2=80=AFPM Lawrence Vel=C3=A1zquez <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!=C2=A0 Had that in my function for years, thought it meant &= #39;pattern
> following'.=C2=A0 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 :(=C2=A0 A few examples would b= e so helpful.

See the description of "fc" in zshbuiltins(1).=C2=A0 No examples,= though.

--
vq



--
Ma= rk J. Reed <mar= kjreed@gmail.com>
--0000000000006ed38c061a166d5e--