echo is striping mah quotes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting echo is striping mah quotes
# 1  
Old 03-11-2009
echo is striping mah quotes

As the title says, echo is striping my quotes and I need them.

echo "<?xml version="1.0" encoding="ISO-8859-1"?>"

returns:

<?xml version=1.0 encoding=ISO-8859-1?>

Obviously,

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"

returns the result I need:

<?xml version="1.0" encoding="ISO-8859-1"?>

But I'm having a hard time crafting a sed statement to fix it. Any ideas?
# 2  
Old 03-11-2009
Try...
Code:
echo '<?xml version="1.0" encoding="ISO-8859-1"?>'

# 3  
Old 03-11-2009
Quote:
Originally Posted by s_becker
As the title says, echo is striping my quotes and I need them.

echo "<?xml version="1.0" encoding="ISO-8859-1"?>"

It is not echo that is stripping your quotes, it is the shell; echo will not even see them.
# 4  
Old 03-11-2009
Problem solved:

Code:
sed -i 's/"<?xml version="1.0" encoding="ISO-8859-1"?>/"<?xml version=\\\"1.0\\\" encoding=\\\"ISO-8859-1\\\"?>"/g' script.sh

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Printing double quotes in echo command

Please help me to use echo or printf type of command to print some value from variable within double quotes - I want to print the double quote ( " ") also. I tried #!/bin/bash VALUE=some_value echo '{"value" : "$VALUE"}' I was expecting the above script would produce .. {"value" :... (3 Replies)
Discussion started by: atanubanerji
3 Replies

2. Shell Programming and Scripting

Double quotes and variable proble in echo

HI Guys, I want to echo below line in my file :- lpd | grep AL | nawk '{print "1dLA - " $0} How can i echo same Output (4 Replies)
Discussion started by: pareshkp
4 Replies

3. Shell Programming and Scripting

Unable to echo single quotes inside awk

# echo 'export HISTFILE=/var/log/history/history_$(uname -n)_$(date +%Y:%b:%d:%H:%M)_$(who am i | awk '{print \$1}')' >> new_file # # cat new_file export HISTFILE=/var/log/history/history_$(uname -n)_$(date +%Y:%b:%d:%H:%M)_$(who am i | awk {print $1}) # Now how to echo the quotes around the... (2 Replies)
Discussion started by: proactiveaditya
2 Replies

4. Shell Programming and Scripting

[Solved] echo not updating double quotes in output

Hi , I have a script to update firefox proxy. But the echo is not updating the double quotes. paste /home/names.txt /home/ip.txt | while read i j do mkdir $i echo "user_pref("network.proxy.http", "$j");" >> /home/$i/prefs.js echo "user_pref("network.proxy.http_port", 8080);" >>... (3 Replies)
Discussion started by: ranjancom2000
3 Replies

5. Shell Programming and Scripting

problem with echo inserting single quotes

Consider the following script: #!/bin/bash exclude='Archive PST,SystemState' IFS=$"," rsyncExclusions=$(for exclude in ${exclude}; do echo -n -e --exclude=\"${exclude}\"\ ; done) unset IFS echo rsync $rsyncExclusions test rsync -avh --delete --delete-excluded "$rsyncExclusions"... (7 Replies)
Discussion started by: jelloir
7 Replies

6. Shell Programming and Scripting

Using echo to print double quotes along with variable substitution

Hi, I am generating html code using cshell, but i am having one problem while printing double quotes, I need to write following code in file. where $var contains list of web address <a href="$var">$var</a> So i am using echo "<a href="$var">$var</a>" > file.html But with this " in... (4 Replies)
Discussion started by: sarbjit
4 Replies

7. Shell Programming and Scripting

Perl echo with double quotes

I need to echo a string that has double quotes in a Perl script. #!/usr/bin/env perl `echo Rule123 -comment \"blah blah\" >> $filename` I'd like to get below appended to $filename: Rule 123 -comment "blah blah" But instead, the double quotes are lost: Rule 123 -comment blah bah ... (1 Reply)
Discussion started by: slchin
1 Replies

8. Web Development

PHP echo everything including brackets and quotes

How can I print exactly what I want in between my quotes? I have xml that I want to echo exactly and it is not printing out the brackets and gets hung up at the "<?" and all that. Is there a way I can just say echo exactly between these quotes? (2 Replies)
Discussion started by: mainegate
2 Replies

9. Shell Programming and Scripting

striping the text in AWK

hello, what I have: --- lots of text bla bla bla PATCH MANAGEMENT AND SOFTWARE UPDATES - EXTERNAL Risk Severity: High Area: External Network Relative Rating: Medium lots of text bla bla bla WIRELESS AP Risk Severity: High Area: External Network Relative Rating: Poor ... (3 Replies)
Discussion started by: yoyo123
3 Replies

10. Shell Programming and Scripting

echo using single quotes

Hi, Please help me to echo the following statement using single quotes Why can't I write 's between single quotes Thanks in advance, Chella (3 Replies)
Discussion started by: chella
3 Replies
Login or Register to Ask a Question