It seems like consecutive $! are mis-processed. This has always worked - since csh days and bash 1.x. But sometime after 4.1 or 4.2, it got broken. Heres my system info and version data
/home/fox/src/proc@allie: cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS" /home/fox/src/proc@allie: help | head GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu) These shell commands are defined internally. Type `help' to see this list. Type `help name' to find out more about the function `name'. Use `info bash' to find out more about the shell in general. Use `man -k' or `info' to find out more about commands not in this list. A star (*) next to a name means that the command is disabled. job_spec [&] history [-c] [-d offset] [n] or hist> (( expression )) if COMMANDS; then COMMANDS; [ elif C> /home/fox/src/proc@allie: echo abc abc /home/fox/src/proc@allie: echo abc!$ echo abcabc abcabc /home/fox/src/proc@allie: echo !$!$ echo abcabc!$ abcabc!$ Something like "echo abc!$<space>!$" works fine - but adjacent expansions do not. many thanks