Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15704
| From | Ilkka Virta <itvirta@iki.fi> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Backslash missing in brace expansion |
| Date | 2019-12-06 22:29 +0200 |
| Message-ID | <mailman.433.1575664257.1979.bug-bash@gnu.org> (permalink) |
| References | <20191205201157.cd481936f76d95bbdfabc73c@schrader-schulte.de> <662e2328-f331-c554-afcf-fd3819f6beab@case.edu> <20191206055304.076d6115afa3a4f2a6a21c34@schrader-schulte.de> <5b5064a8-7175-42e7-1eb5-6374dee6c11e@redhat.com> <21761e28-c496-ff67-d7b7-628c9325085f@iki.fi> |
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 ASCII code) is
>>>> missing in brace expansion. The same behaviour seems to be found in
>>>> bash 5.0.
>>>
>>> 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 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 substitution: no closing "`" in `d
I get that with 4.4 and 'echo b{Z..a}d' too, the trailing letter seems
to trigger it.
Which also doesn't seem to make sense, but one might argue that {Z..a}
doesn't make much sense in the first place. Seriously, is there an
actual use case for such a range?
It doesn't seem to even generalize from that if you go beyond letters,
so you can't do stuff like generating all the printable ASCII characters
with it in Bash.
--
Ilkka Virta / itvirta@iki.fi
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Backslash missing in brace expansion Ilkka Virta <itvirta@iki.fi> - 2019-12-06 22:29 +0200
csiph-web