the best way maybe, use "here" document:
which writes until reaching a guard string, conventionally
EOF or EOD
e.g:
cat > ouput.file.name <<EOF
put all you need here
variables will work normaly
var1 = $var1
var2 = $var2
blah
blah
EOF
the EOF ends the output, put it at the beginning of the line.
billy
|