[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About `M-C-e` expand result `'` failed
From: |
A4-Tacks |
Subject: |
Re: About `M-C-e` expand result `'` failed |
Date: |
Tue, 30 Jan 2024 22:16:41 +0800 (GMT+08:00) |
I think the results can be processed through methods such as `printf %q` or
`"${result@Q}"`
---- Replied Message ----
| From | Zachary Santer<zsanter@gmail.com> |
| Date | 01/30/2024 22:11 |
| To | A4-Tacks<wdsjxhno1001@163.com> |
| Cc | bug-bash@gnu.org |
| Subject | Re: About `M-C-e` expand result `'` failed |
On Tue, Jan 30, 2024 at 6:48 AM Zachary Santer <zsanter@gmail.com> wrote:
Would it be unreasonable to expect that the argument to the outermost echo
after M-C-e still be in double-quotes? Or potentially placed in single-quotes.
That way, the line would be evaluated the same way as it would've been without
M-C-e.
Double-quoting is probably the way to go in that case, but then the M-C-e logic
has to also be smart enough to backslash escape things so the line gets
evaluated the same way as it otherwise would've been. And single-quotes should
be left in place as well.
$ var='foo'
$ echo "$( echo '${var}' )" # enter
${var}
$ echo "$( echo '${var}' )" # M-C-e
$ echo ${var} # enter
foo
# Would've expected: echo "\${var}"
$ echo $( echo '${var}' ) # enter
${var}
$ echo $( echo '${var}' ) # M-C-e
$ echo ${var} # enter
foo
# Would've expected: echo \${var}
$ echo '${var}' # enter
${var}
$ echo '${var}' # M-C-e
$ echo ${var} # enter
foo
# Would've expected: echo '${var}'
$ echo "${var}" # enter
foo
$ echo "${var}" # M-C-e
$ echo foo
foo
# Would've expected: echo "foo"
From the manual:
> shell-expand-line (M-C-e)
> Expand the line as the shell does. This performs alias and history
> expansion as well as all of the shell word expansions. See HISTORY EXPANSION
> below for a description of history expansion.
Doesn't list quote removal.
- About `M-C-e` expand result `'` failed, A4-Tacks, 2024/01/29
- Re: About `M-C-e` expand result `'` failed, Zachary Santer, 2024/01/30
- Re: About `M-C-e` expand result `'` failed, Zachary Santer, 2024/01/30
- Re: About `M-C-e` expand result `'` failed,
A4-Tacks <=
- Re: About `M-C-e` expand result `'` failed, Zachary Santer, 2024/01/30
- Re: About `M-C-e` expand result `'` failed, Andreas Schwab, 2024/01/30
- Re: About `M-C-e` expand result `'` failed, Zachary Santer, 2024/01/30
- Re: About `M-C-e` expand result `'` failed, Chet Ramey, 2024/01/31
- Re: About `M-C-e` expand result `'` failed, Mike Jonkmans, 2024/01/31