5.5 Escaping , quoting
Escaping - providing a \ (backslash) before a wildcard to remove its special meaning
Quoting - enclosing the wildcard or entire pattern within quotes. Anything within these quotes is left alone by the shell and not interpreted.
Escaping *
Escaping [ ]
Escaping the SPACE
Escaping the \
Escaping the newline character
Escaping is tedious when there are many characters to protect, quoting is better solution.
e.g. $rm 'chap*' or $rm chap\*
$rm "My Document.doc" or $rm My\ Document.doc
$echo 'The characters |, <, > and $ are special'
$echo The character \| , \< , \> and \$ are special
Note - Single quotes protect all the characters. Double quotes do not protect $ and ' (backquote)
Last modified: Friday, 6 December 2019, 8:27 PM