Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-23 Thread Greg Wooledge
On Wed, May 22, 2019 at 10:23:04PM +, Charles-Henri Gros wrote: > But unfortunately, grep was just illustrative, I'm using another tool > that takes a regex but has no "-F" option 1. The questioner's first description of the problem/question will be misleading. 9. All examples given by the

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Robert Elz
Date:Wed, 22 May 2019 22:23:04 + From:Charles-Henri Gros Message-ID: | But unfortunately, grep was just illustrative, I'm using another tool | that takes a regex but has no "-F" option (though admittedly with some | effort I could add one, I wrote the tool

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Charles-Henri Gros
On 5/22/19 3:13 PM, Robert Elz wrote: > Date:Wed, 22 May 2019 17:34:22 + > From:Charles-Henri Gros > Message-ID: > > > | 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 t

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Robert Elz
Date:Wed, 22 May 2019 17:34:22 + From:Charles-Henri Gros Message-ID: | 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

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Andreas Kusalananda Kähäri
On Wed, May 22, 2019 at 05:34:22PM +, 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 origin

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Andreas Schwab
On Mai 22 2019, Charles-Henri Gros wrote: > The file name is the regex (argument to "-e"), not the file "grep" > reads. I want to check that some text file contains a reference to a file. > > But it looks like this would work: > > for file in $(find ...); do grep -e "$(echo -n "$file" | sed 's/\$

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Chet Ramey
On 5/22/19 3:14 PM, Charles-Henri Gros wrote: > That's what I find a bit surprising (but shells are complicated, so > maybe this is right. All I know is that the code used to work). I didn't > think glob expansions applied to command expansions. Command substitution is one of the word expansions,

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Charles-Henri Gros
On 5/22/19 10:47 AM, Greg Wooledge wrote: > On Wed, May 22, 2019 at 05:34:22PM +, Charles-Henri Gros wrote: >> On 5/22/19 5:43 AM, Greg Wooledge wrote: >>> Standard disclaimers apply. Stop using unquoted variables and these >>> bugs will stop affecting you. Nevertheless, Chet may want to take

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Greg Wooledge
On Wed, May 22, 2019 at 07:14:44PM +, Charles-Henri Gros wrote: > The file name is the regex (argument to "-e"), not the file "grep" > reads. I want to check that some text file contains a reference to a file. > > But it looks like this would work: > > for file in $(find ...); do grep -e "$(e

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Greg Wooledge
On Wed, May 22, 2019 at 05:34:22PM +, Charles-Henri Gros wrote: > On 5/22/19 5:43 AM, Greg Wooledge wrote: > > Standard disclaimers apply. Stop using unquoted variables and these > > bugs will stop affecting you. Nevertheless, Chet may want to take a > > peek. > > What unquoted variables? Ar

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Charles-Henri Gros
On 5/22/19 5:43 AM, Greg Wooledge wrote: > On Wed, May 22, 2019 at 05:25:43PM +0700, Robert Elz wrote: >> Date:Tue, 21 May 2019 22:11:20 + >> From:Charles-Henri Gros >> Message-ID: >> >> >> | The existence or not of the file should not have any effect. >> >> Bu

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Chet Ramey
On 5/22/19 9:33 AM, Robert Elz wrote: > Date:Wed, 22 May 2019 08:43:00 -0400 > From:Greg Wooledge > Message-ID: <20190522124300.gz1...@eeg.ccf.org> > > | It seems to be unique to bash 5. If it's a bug fix, then I'm not > | understanding the rationale. Backslashe

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Robert Elz
Date:Wed, 22 May 2019 08:43:00 -0400 From:Greg Wooledge Message-ID: <20190522124300.gz1...@eeg.ccf.org> | It seems to be unique to bash 5. If it's a bug fix, then I'm not | understanding the rationale. Backslashes shouldn't be consumed during | glob expansion.

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Greg Wooledge
On Wed, May 22, 2019 at 05:25:43PM +0700, Robert Elz wrote: > Date:Tue, 21 May 2019 22:11:20 + > From:Charles-Henri Gros > Message-ID: > > > | The existence or not of the file should not have any effect. > > But it does, and is intended to. If the mattern m

Re: Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-22 Thread Robert Elz
Date:Tue, 21 May 2019 22:11:20 + From:Charles-Henri Gros Message-ID: | The existence or not of the file should not have any effect. But it does, and is intended to. If the mattern matches a file (when patyhname expanded as a result of the unquoted command s

Backslash mysteriously disappears in command expansion when unescaping would reference an existing file

2019-05-21 Thread Charles-Henri Gros
output: Linux d-us6a-ubuntu-03 5.0.0-13-generic #14-Ubuntu SMP Mon Apr 15 14:59:14 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.0 Patch Level: 3 Release Status: release Description: Backslash mysteriously disappears in command expansion when