In bash:
$ a=1
$ echo $a
1
$ echo "$a"
1
But:
$ echo !
!
$ echo "!"
bash: !: event not found
Why in "echo !", bash don't expand.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityIn "echo !", after bang followed the carriage return.
man bash
!
Start a history substitution, except when followed by a blank, newline, carriage return, = or ( (when the extglob shell option is enabled using the shopt builtin).
echo "!"
expand andecho !
not expand?