bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Alex Bochannek
Subject: Re: Document that here strings don't support brace expansion.
Date: Mon, 13 Mar 2023 16:06:02 -0700
User-agent: Gnus/5.13 (Gnus v5.13)

Chet Ramey <chet.ramey@case.edu> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]