Escaping Escape Characters


Watamote

Even as late as today I was getting my escape characters mixed up as I studied for an in-class assessment. Here’s a short summary of the different types of escape characters for the command line (bash specific, but can work in some other shells I’m sure?).

  • The backslash (\) removes the special meaning of the next character only. (Used often as an escape character, I find.)
  • The single quote (') preserves literal values of the characters that are within the quotes. They are not the same as backticks (`) though, that tells script to execute command before executing script, capture output and paste to shell script.
  • The double quote (") that is similar to the single quotes but some characters are able to retain their special values, for example $A.

I better not get that wrong tomorrow, or it could result in a huge headache for me when debugging any scripts. They’re bringing back LinuxGym for this assessment, which I haven’t seen since first year in 2010!