Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Escape key ie \ 1

Status
Not open for further replies.

JBaileys

Technical User
Jun 23, 2003
244
US


On a closed thread Ken suggested escaping the " (ie \)"
What does this mean - are there any good references to escape keys?

==== Highlights from closed message =============

KenCunningham
Have you tried escaping the " (ie \")?


Perhaps a simple one, but I could do with a pointer here.
I am trying to match the string "something" including the "'s.

if [ "$variable" = ""something""]
then
exec something
else
something else
fi

But I keep getting "Too many arguments" error. Is there a simple way to match the "something" , including the ""s

 
Either:
Code:
if [ "$variable" = "\"something\"" ]
or:
Code:
if [ "$variable" = '"something"' ]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Certain characters do special things within scripts to use them as a normal character they need escaping

echo """ wouldn't work

but

echo "\"" would because the " character has been escaped using the \ character.

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top