Expansion of exclamation mark in single quotes in subcommand
From:
Maxdamantus
Subject:
Expansion of exclamation mark in single quotes in subcommand
Date:
Mon, 21 Apr 2014 16:10:30 +1200
version: 4.3.11(5)
This seems like a bug, but it seems to have been here for a few years
(from the git repository, bash-3.0 displays this behaviour while
bash-2.05b doesn't).
With history expansion enabled (set +H):
$ echo '!!' # good
!!
$ echo "$(echo '!!')" # not good; !! expands
echo "$(echo 'echo '!!'')"
echo !!
$ echo '$$' # good
$$
$ echo "$(echo '$$')" # good
$$