How-to-simply...

Scream properly in Bash

  • 1 echo "AAAAH!". works. A ! right before the closing double quote isn't expanded (bash 4.3 and later)
  • 2 echo "AAAAH!!" doesn't. "the previous command"
  • 3 echo "fix(record)!: " fails outright, !: asks for a word of a previous command
  • 4 echo "fix(record)"'!'"" works.
  • N !! Entire previous command
    !$ Last arg of prev cmd
    !* All args of prev cmd
    !^ First arg of prev cmd
    !str Most recent cmd starts with

References