Escape Characters
Linux Commands - Shells

Escape Characters
There are specific characters that are important to the shell in which the shell will react differently to.

Lesson 8 | Lesson 10


The double quotes " set the use of spaces and tabs.  Without the double quotes the shell sees the space as the same.  The script below is an example.

#!/bin/sh
echo Folder         Created
echo "Folder         Created"


If you wanted to put Mike's New in quotes you would have to use escape character \ to make it work.

#!/bin/sh
echo Folder         Created
echo ""Mike's New" Folder         Created"
echo “\”Mike's New\” Folder     Created”


The characters " $ ` and \ are all interpreted by the shell even when in double quotes so you will need an escape character to avoid this situation, as you see above.

If you want to use a “ or a \ then you need to use an escape character.

Echo “If you want to use a \” or a \\ the you need to use an escape character.”

The $ sign is significant because it will indicate a variable.

 


Copyright CyberMontana Inc. and BeginLinux.com
All rights reserved. Cannot be reproduced without written permission. Box 1262 Trout Creek, MT 59874