lundi 2 mars 2015

How to echo `single quote` when using single quote to wrap special characters in shell?


I'm reading shell tutorial today from http://ift.tt/1E8InDY


In which it mentions:



If a single quote appears within a string to be output, you should not put the whole string within single quotes instead you whould preceed that using a backslash () as follows:




echo 'It\'s Shell Programming'


I tried this on my centos server, it doesn't work, a > prompts out to hint me type more.


I was wondering, since two single quotes transform every special characters into normal characters, which include escape symbol \, but exclude itself, the ',

how should I represent a single single quote 'in a single-quoted phrase?



Aucun commentaire:

Enregistrer un commentaire