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

I think your nawk is missing the last '.

cat <<"EOF" >> filename
lpd | grep AL | nawk '{print "1dLA - " $0}'
EOF

Note the last EOF must be at the beginning of the line, not indented.

what about echo ?? it is possible ?

Sure, but ugly:

echo "lpd | grep AL | nawk '{print \"1dLA - \" $0}'" > whatever

The <<"EOF" trick on the other hand lets you just paste the original text in unmodified. Much less chance of typos.

Note that it's not a property of echo how this works, it's a property of quoting in general.

HI

I am getting my script name in output

lpd | grep AL | nawk '{print "1dLA - " ./gc.sh}'

---------- Post updated at 03:22 PM ---------- Previous update was at 03:18 PM ----------

got it