Here are what I put in bash and the results I got about 'echo':
$ echo '!$'
!$
$ echo "!$"
echo "'!$'"
'!$'
I'd like to know how 'echo' deals with the second input. It seems to me that 'echo' would first print the strings (expand some if necessary) you entered, then execute certain if they are executable.
A more mind-blowing example I can construct but am not able to understand is:
$ echo '!$'
!$
$ echo "!echo "!$""
echo "echo '!$' "'!$'""
echo '!$' !$