On 10/25/15 5:49 PM, Keith Thompson wrote:
> I'm running bash 4.4 beta, built from source (bash-4.4-beta.tar.gz) on
> Linux Mint 17.2.
> 
> !! history expansion works correctly in simple cases, but not when part of
> a $(...) expansion.
> 
> This problem does not occur with bash 4.3.11
> 
> The last error message shown occurred when I typed Esc Ctrl-E
> (shell-expand-line) after typing
> "echo $(!!".
> 
> $ bash --norc
> bash-4.4$ echo $BASH_VERSION
> 4.4.0(1)-beta
> bash-4.4$ echo hello
> hello
> bash-4.4$ !!
> echo hello
> hello
> bash-4.4$ echo hello
> hello
> bash-4.4$ echo $(!!)
> bash: !!: command not found

Yes.  This was a bug fix.  The history expansion should be deferred until
the subshell, since the rest of the processing of that command is performed
in the subshell.

http://lists.gnu.org/archive/html/bug-bash/2015-01/msg00028.html

is the original bug report.  I will have to see if there is a reasonable
way to perform history expansion in this context.

> bash-4.4$ echo hello
> hello
> bash-4.4$ echo $(!!TRACE: pid 3822: xparse_dolparen:17: ep[-1] != RPAREN
> (33), ep = `'
> TRACE: pid 3822: xparse_dolparen:17: base[8] != RPAREN (33), base = `echo 
> $(!!'

This happens because shell-expand-line attempts to perform word expansion,
and the unterminated command substitution causes this debug message.

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

Reply via email to