我有一个shell脚本,它运行一个工具。将shell脚本的退出代码写入文件
我想要的是,这个shell脚本的退出代码应该写在.XML
文件中。
我做了什么至今
# command1
# command2
echo "<status>" > /home/buser/ABC/status.xml // Writing into XML
cp2foss -f ABC -q all /srv/foss/$archive_file2 --user foss --password foss;
echo $? >> /home/buser/ABC/status.xml /// Wrting exit code into XML
echo "</status>" >> /home/buser/ABC/status.xml
其完美的工作,但我不认为这是一个很好的实践cosing。
如何在没有违规的情况下在XML文件中写入退出代码?
如果您想要进行代码审查,请考虑使用http://codereview.stackexchange.com – kojiro 2013-02-15 13:03:10