set -e and set -x in shell script

set -x Print shell command before execute it. This feature help programmers to track their shell script. set -e If the return code of one command is not 0 and the caller does not check it, the shell script will exit. This feature make shell script robust. set -e and set -x often appear at … Read more

How to insert a new element under another with xmlstarlet?

I had a similar problem: I had a Tomcat configuration file (server.xml), and had to insert a <Resource> tag with pre-defined attributes into the <GlobalNamingResources> section. Here is how it looked before: <GlobalNamingResources> <!– Editable user database that can also be used by UserDatabaseRealm to authenticate users –> <Resource name=”UserDatabase” auth=”Container” type=”org.apache.catalina.UserDatabase” description=”User database that … Read more