bug-bash
[Top][All Lists]
Advanced

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

Re: About `M-C-e` expand result `'` failed


From: Chet Ramey
Subject: Re: About `M-C-e` expand result `'` failed
Date: Fri, 2 Feb 2024 16:15:39 -0500
User-agent: Mozilla Thunderbird

On 2/2/24 3:09 PM, Mike Jonkmans wrote:

Maybe:

Several kinds of expansion are performed in order: first brace expansion;
then tilde expansion, parameter and variable expansion, command substitution
and arithmetic expansion (done in a left-to-right fashion); word splitting;
pathname expansion and finally quote removal.

I'll come up with something.


shell-expand-line (M-C-e)
         Expand  the line by performing shell word expansions.  This per-
         forms alias and history expansion, $'string' and $"string" quot-
         ing, tilde expansion, parameter and variable  expansion,  arith-
         metic expansion, word splitting, and quote removal.  See HISTORY
         EXPANSION below for a description of history expansion.

That form is clearer indeed.
But isn't that missing `, process substitution (if available)'?

Command substitution and process substitution are both missing. You can
inhibit those by using an explicit argument -- I'll have to add that to
the description.

Maybe it is confusing that a (quote) removal is an expansion. Oh well.
What is the logic here?
Expansion is making things bigger. Removal is more like contraction.

Come on, that definition doesn't hold up.

LONGVARNAME=1
echo ${LONGVARNAME} $(echo a)

They are all replacing one word with another based on the presence of
characters in the original word. Think of it as more like macro expansion
(replacing the text of a macro with its value) than the dictionary
definition.


Then after review of the expansion, I could accept it.
Then undo the editing operation and let the expansions happen all over
again as part of command execution.

That is a nice tip. I didn't realize that it was possible to undo.
So normally I would avoid using expansions. :)

You can undo just about any operation in readline. But the side effects
of, for instance, command substitution persist.

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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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