Re: Document that here strings don't support brace expansion.

2023-03-13 Thread Chet Ramey

On 3/11/23 3:39 AM, Alex Bochannek wrote:

Bash Version: 5.2
Patch Level: 15
Release Status: release

Description:

The documentation for here strings says:

"The WORD undergoes tilde expansion, parameter and variable expansion,
command substitution, arithmetic expansion, and quote removal.  Filename
expansion and word splitting are not performed."

It is missing brace expansion, which is not supported:


I wouldn't say it's missing, since it's not listed as one of the expansions
that here-strings undergo. The filename expansion and word splitting are
called out because people asked about them. To this point, no one has asked
about brace expansion.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/




Re: Document that here strings don't support brace expansion.

2023-03-13 Thread Alex Bochannek
Chet Ramey  writes:

> On 3/11/23 3:39 AM, Alex Bochannek wrote:
>> Bash Version: 5.2
>> Patch Level: 15
>> Release Status: release
>> Description:
>> The documentation for here strings says:
>> "The WORD undergoes tilde expansion, parameter and variable
>> expansion,
>> command substitution, arithmetic expansion, and quote removal.  Filename
>> expansion and word splitting are not performed."
>> It is missing brace expansion, which is not supported:
>
> I wouldn't say it's missing, since it's not listed as one of the expansions
> that here-strings undergo. The filename expansion and word splitting are
> called out because people asked about them. To this point, no one has asked
> about brace expansion.

That's a fair point. I was maybe a bit surprised that this didn't work.
It seems less surprising that it would not in a here-doc, but from a
user's perspective, I can see someone expecting it for a here-string. I
didn't submit this as a bug against the functionality because even
though I think it would be useful, being consistent between here-docs
and here-strings and with how Zsh does it is beneficial. Documentation
that is more explicit about this is helpful in my opinion.

I also noticed that there doesn't seem to be an easy way to expand
braces with Readline, which I suspect may have to do with where in the
parsing process of Bash brace expansion actually happens. This
suggestion from a few years ago does the trick, but feels like it
shouldn't be necessary.

https://unix.stackexchange.com/questions/468135/bash-in-line-brace-expansion

The documentation for M-C-e says "Expand the line as the shell does.
This performs alias and history expansion as well as all of the shell
word expansions (*note Shell Expansions::)." Maybe that can be tightened
up a bit as well to clarify what it does not do?

Thanks!

-- 
Alex.