|
| From: | Andreas Kusalananda Kähäri |
| Subject: | Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file |
| Date: | Wed, 22 May 2019 21:16:04 +0200 |
| User-agent: | Mutt/1.11.4 (2019-03-13) |
On Wed, May 22, 2019 at 05:34:22PM +0000, Charles-Henri Gros wrote:
[cut]
> The problem I'm trying to solve is to iterate over regex-escaped file
> names obtained from a "find" command. I don't know how to make this
> work. It works with other versions of bash and with other shells.
>
> The original is closer to something like this:
>
> for file in $(find ... | sed 's/\$/\\$/g'); do grep -e "$file"
> someinput; done
You may want to use "grep -F" to match fixed strings (not regular
expressions):
find ... -exec grep -F -e {} someinput \;
Add -x to grep if you want full line matches only.
Tis is assuming you'd want to look for the found pathnames in
"someinput".
>
> It used to work. Now it doesn't. I do not know how to make it work again.
>
>
> --
> Charles-Henri Gros
>
--
Kusalananda
Sweden
| [Prev in Thread] | Current Thread | [Next in Thread] |