i am creating a script that will take a csv file and make an XML file. The script will also take user entered data to go in the xml as well. I have created a script that will make my XML, but i am having problems entering my read in variable at the start of the file.
Ultimately there will be a longer line being entered, with 3 variables in the line - i am just writing the basics at the minute.
My problem is i am unable to read in the variable $BUS into ed command. I have read that it is possible, but i have been unable to make it work.
i tried my EOF with and without the single quote.
echo "Enter BUS name"
read BUS
echo $BUS
awk -f xmlbody $FILE > result.xml
file=result.xml
ed -s $file <<'EOF'
0a
<?xml version="1.0" encoding="utf-8"?>
$BUS
<Data>
.
$a
</Data>
.
w
EOF
exit 0