Hello All,
I am running a shell script, which in turn runs a perl script. When this perl script runs successfully, the output is generated as an XML file. The following is a snippet of my code:
....
....
...
if [ condition is true] ;
then
perl myScript.pl
echo "<statistics>"
echo " <update>YES</update>"
echo " <date>`date +\%m\%d\%Y.\%H\%M\%S`</date>"
echo " <id>$id</id>"
echo " <name>$name</name>"
echo "</statistics>"
....
...
..
To run this shell script (and redirect the output in an xml file)
./test.sh ARG1 >> output.xml
The output XML file does not get displayed properly, since it does not have a 'parent tag'. If I manually add this tag, I can display the file:
XML File (does not displays without a parent tag <master_log>):
<statistics>
<update>NO</update>
<date>05202012.180001</date>
<id>my_Local_1</id>
<name>AAA</name>
</statistics>
<statistics>
<update>NO</update>
<date>05212012.134043</date>
<id>LOCAL_MY_2</id>
<name>XXX</name>
</statistics>
...
..
.
How can I automatically add tags <master_log></master_log>, without having to do so manually? And also without affecting the log append procedure everytime the script runs successfully?