Backslash missing in brace expansion

2019-12-05 Thread Martin Schulte
Hello, please have a look: $ uname -a Linux martnix4 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64 GNU/Linux $ echo ${BASH_VERSINFO[@]} 4 4 12 1 release x86_64-pc-linux-gnu $ set -x $ echo {Z..a} + echo Z '[' '' ']' '^' _ '`' a Z [ ] ^ _ ` a It looks as if the backslash (bet

Re: Backslash missing in brace expansion

2019-12-05 Thread Chet Ramey
On 12/5/19 11:11 AM, Martin Schulte wrote: > Hello, > > please have a look: > > $ uname -a > Linux martnix4 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) > x86_64 GNU/Linux $ echo ${BASH_VERSINFO[@]} > 4 4 12 1 release x86_64-pc-linux-gnu > $ set -x > $ echo {Z..a} > + echo Z '[' ''

Re: Backslash missing in brace expansion

2019-12-05 Thread Martin Schulte
Hi Chet, hi all! On Thu, 5 Dec 2019 12:01:31 -0800 Chet Ramey wrote: > On 12/5/19 11:11 AM, Martin Schulte wrote: > > Hello, > > > > please have a look: > > > > $ uname -a > > Linux martnix4 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 > > (2019-11-11) x86_64 GNU/Linux $ echo ${BASH_VERSINFO[

Re: Backslash missing in brace expansion

2019-12-06 Thread Chet Ramey
On 12/5/19 8:53 PM, Martin Schulte wrote: >> It's an unquoted backslash, which is removed by quote removal when the >> words are expanded. Look at the extra space between `[' and `]'; that's >> the null argument resulting from the unquoted backslash. > > Yes - sure. But then I'm wondering why the

Re: Backslash missing in brace expansion

2019-12-06 Thread Chet Ramey
On 12/6/19 9:23 AM, Robert Elz wrote: > I'm not sure I accept the explanation for the \ missing though, quoting is > also a parser activity (though some of it also happens in pattern matching). > But normally, backslashes (or any other form of quoting) that result from > expansions are simply char

Re: Backslash missing in brace expansion

2019-12-06 Thread Robert Elz
Date:Fri, 6 Dec 2019 05:53:04 +0100 From:Martin Schulte Message-ID: <20191206055304.076d6115afa3a4f2a6a21...@schrader-schulte.de> | Yes - sure. But then I'm wondering why the unquoted backtick doesn't | start command substitution: Too late. Syntax elements must

Re: Backslash missing in brace expansion

2019-12-06 Thread Eric Blake
On 12/5/19 10:53 PM, Martin Schulte wrote: (2019-11-11) x86_64 GNU/Linux $ echo ${BASH_VERSINFO[@]} 4 4 12 1 release x86_64-pc-linux-gnu $ set -x $ echo {Z..a} + echo Z '[' '' ']' '^' _ '`' a Z [ ] ^ _ ` a It looks as if the backslash (between [ and ] in ASCII code) is missing in brace expansi

Re: Backslash missing in brace expansion

2019-12-06 Thread Eric Blake
On 12/6/19 11:27 AM, Chet Ramey wrote: On 12/6/19 9:23 AM, Robert Elz wrote: I'm not sure I accept the explanation for the \ missing though, quoting is also a parser activity (though some of it also happens in pattern matching). But normally, backslashes (or any other form of quoting) that resu

Re: Backslash missing in brace expansion

2019-12-06 Thread Ilkka Virta
On 6.12. 21:36, Eric Blake wrote: On 12/5/19 10:53 PM, Martin Schulte wrote: (2019-11-11) x86_64 GNU/Linux $ echo ${BASH_VERSINFO[@]} 4 4 12 1 release x86_64-pc-linux-gnu $ set -x $ echo {Z..a} + echo Z '[' '' ']' '^' _ '`' a Z [  ] ^ _ ` a It looks as if the backslash (between [ and ] in ASCI

Re: Backslash missing in brace expansion

2019-12-06 Thread Chet Ramey
On 12/6/19 12:29 PM, Ilkka Virta wrote: >>> Yes - sure. But then I'm wondering why the unquoted backtick doesn't >>> start command substitution: >> >> It may be version dependent: >> >> $ echo ${BASH_VERSINFO[@]} >> 5 0 7 1 release x86_64-redhat-linux-gnu >> >> $ echo b{Z..a}d >> bash: bad substit

Re: Backslash missing in brace expansion

2019-12-08 Thread Martin Schulte
Hello, thanks a lot for all the answers! I would like to suppose (Ilkka already argued in this direction) that in future versions of bash {x..C} should expand to x y z A B C. Best regards, Martin

Re: Backslash missing in brace expansion

2019-12-08 Thread Andreas Kusalananda Kähäri
On Sun, Dec 08, 2019 at 11:00:03AM +0100, Martin Schulte wrote: > Hello, > > thanks a lot for all the answers! > > I would like to suppose (Ilkka already argued in this direction) that in > future versions of bash {x..C} should expand to x y z A B C. > > Best regards, > > Martin Another idea w

Not missing, but very hard to see (was Re: Backslash missing in brace expansion)

2019-12-12 Thread L A Walsh
On 2019/12/06 14:14, Chet Ramey wrote: Seems very hard to print out that backquote though. Closest I got was bash converting it to "''": read -r -a a< <(printf "%q " {Z..a}) my -p a declare -a a=([0]="Z" [1]="\\[" [2]="''" [3]="\\]" [4]="\\^" [5]="_" [6]="\\\`" [7]="a") #2 is where backsl

Re: Not missing, but very hard to see (was Re: Backslash missing in brace expansion)

2019-12-12 Thread Greg Wooledge
On Thu, Dec 12, 2019 at 11:43:58AM -0800, L A Walsh wrote: > > read -r -a a< <(printf "%q " {Z..a}) > > my -p a > declare -a a=([0]="Z" [1]="\\[" [2]="''" [3]="\\]" [4]="\\^" [5]="_" > [6]="\\\`" [7]="a") Nice try. I guess the takeaway from this thread is: "You cannot mix capital and lowercase

Re: Not missing, but very hard to see (was Re: Backslash missing in brace expansion)

2019-12-12 Thread Ilkka Virta
On 12.12. 21:43, L A Walsh wrote: On 2019/12/06 14:14, Chet Ramey wrote: Seems very hard to print out that backquote though.  Closest I got was bash converting it to "''": The backquote is in [6], and the backslash disappears, you just get the pair of quotes in [2] because that's how printf %

Re: Not missing, but very hard to see (was Re: Backslash missing in brace expansion)

2019-12-12 Thread L A Walsh
On 2019/12/12 13:01, Ilkka Virta wrote: On 12.12. 21:43, L A Walsh wrote: On 2019/12/06 14:14, Chet Ramey wrote: Seems very hard to print out that backquote though. Closest I got was bash converting it to "''": The backquote is in [6], and the backslash disappears, you just get th

Re: Not missing, but very hard to see (was Re: Backslash missing in brace expansion)

2019-12-12 Thread Eli Schwartz
On 12/12/19 9:57 PM, L A Walsh wrote: > > > On 2019/12/12 13:01, Ilkka Virta wrote: >> On 12.12. 21:43, L A Walsh wrote: >>   >>> On 2019/12/06 14:14, Chet Ramey wrote: >>> >>> Seems very hard to print out that backquote though.  Closest I got >>> was bash converting it to "''": >>>     >> >> Th

Re: Not missing, but very hard to see (was Re: Backslash missing in brace expansion)

2019-12-13 Thread Chet Ramey
On 12/12/19 9:57 PM, L A Walsh wrote: The backquote is in [6], and the backslash disappears, you just get the pair of quotes in [2] because that's how printf %q outputs an empty string. -    I'm sorry, but you are mistaken.    The characters from 'Z' (0x5A) through 'z' (0x61) are: 0x5A