zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: egrep --color=always 'zsh\.'
Date: Tue, 2 Apr 2024 13:53:19 -0700	[thread overview]
Message-ID: <d9eb68bc-f520-4446-942c-5b4360597337@eastlink.ca> (raw)
In-Reply-To: <85dd54c7-d221-4c19-b3f5-8d8d251529f2@app.fastmail.com>

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



On 2024-04-02 13:14, Lawrence Velázquez wrote:
> The issue is probably that you are using the same pattern for both
> "apt-file search" and egrep, but they don't interpret it in the
> same way.  By default, "apt-file search" does a literal substring
> match, so "\." will match backslash-period.
Right, I know that, my code sample was too lazy.  The only issue is with 
the egrep.
> The function as presented cannot actually work with regex arguments,
> so just switch to "grep -F" and avoid the escaping issues altogether.
If there's no way for the shell to handle it, then that's just what I'll 
do.  Still .... I'm almost sure I've had to deal with this before.  IIRC 
every situation I've come up against has been handled by the right 
combination of quotes and backslashes ... I think.

> Please refrain from referring to zsh as "she". The shell is neither
> a woman nor a ship.
Sure.  But things besides ships are feminized.  Never mind.  As you wish.
> No, egrep does not need the quotes.

    % apt-file search zsh-theme | egrep --color=always zsh.
    ...
    zsh-theme-powerlevel9k: /usr/share/powerlevel9k/powerlevel9k.zsh-theme

    % apt-file search zsh-theme | egrep --color=always zsh\.
    ...
    zsh-theme-powerlevel9k: /usr/share/powerlevel9k/powerlevel9k.zsh-theme

    % apt-file search zsh-theme | egrep --color=always 'zsh.'
    ...
    zsh-theme-powerlevel9k: /usr/share/powerlevel9k/powerlevel9k.zsh-theme

    % apt-file search zsh-theme | egrep --color=always 'zsh\.'
    [ no match ]


... the dot is matching the dash -- or anything else -- unless I use:  
'zsh\.'

    % apt-file search zsh. | egrep --color=always 'zsh\.'
    ...
    zsh-doc: /usr/share/info/zsh.info.gz


... the dot is matched.  Mind, it was easy to be fooled because : egrep 
zsh.
... the dot matches any character *including* a literal dot.



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

  reply	other threads:[~2024-04-02 20:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 16:33 Ray Andrews
2024-04-02 20:14 ` Lawrence Velázquez
2024-04-02 20:53   ` Ray Andrews [this message]
2024-04-02 22:45     ` Lawrence Velázquez
2024-04-02 22:55       ` Bart Schaefer
2024-04-02 23:29         ` Ray Andrews
2024-04-03  8:18         ` Lawrence Velázquez
2024-04-02 23:26       ` Ray Andrews
2024-04-03  3:42   ` Mark J. Reed
2024-04-03 12:50     ` Ray Andrews

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=d9eb68bc-f520-4446-942c-5b4360597337@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --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).