Operating System - HP-UX
1833776 Members
2045 Online
110063 Solutions
New Discussion

Special characters..echo "!"

 
SOLVED
Go to solution
amonamon
Regular Advisor

Special characters..echo "!"

Hello..
I am doing one script and problem goes with special character..

I need to ahve in file this line:



and I did this:

echo "<\!DOCTYPE batchscript SYSTEM \"batch.dtd\">" > finalF

but this does put in finalF this:

<\!DOCTYPE batchscript SYSTEM "batch.dtd">

if I do this:

var="!"
echo "<$var DOCTYPE batchscript SYSTEM \"batch.dtd\">" > finalF

I get:


with space after "!"

stupid small problem ..can anyone figure it I know it is something small..

Regards.. :)
4 REPLIES 4
Oviwan
Honored Contributor

Re: Special characters..echo "!"

Hy

Try it with single quotes:

echo ''

Regards
Peter Godron
Honored Contributor

Re: Special characters..echo "!"

Hi,
on my machine:
$ echo "" > finalF

$ cat finalF
Dennis Handly
Acclaimed Contributor
Solution

Re: Special characters..echo "!"

Why did you think you needed to quote the "!"?

In your $var case, if you don't want a space you could use:
echo "<${var}DOCTYPE ...

But as Peter and Oviwan say, use single quotes.
amonamon
Regular Advisor

Re: Special characters..echo "!"

thanks...last post solved problem...

{} was a catch...