I am trying to insert a string path stored in a variable into an xmlfile as the first part of an attribute value.
The xmlfile is a context.xml file for Tomcat using the form
<Context reloadable="true" docBase="application.war">
...
</Context>
A path, which is the absolute location of a war file to deploy is
$WKSP_APATH="/location/on/server
$WKSP PATH should be inserted as follows
<Context reloadable="true" docBase="/location/on/server/application.war">
...
</Context>
I've tried to find information, but most sources focus on full line insertion. This is the last line to add for my script.
For context the executed line location is given below as an extract from the script it is embedded in
find /$SEARCH_PATH -name "*.xml" -type f|while read fname; do
CONTEXT_FILE=${fname##*/}
cp -rf "/$SEARCH_PATH/$CONTEXT_FILE"
"/$COPY_LOCATION/${PROJECT_CODENAME}-$CONTEXT_FILE"
echo "Copied $CONTEXT_FILE to:
$COPY_LOCATION/$PROJECT_CODENAME-$CONTEXT_FILE for deployment"
#do insert new path on local server here?
done
Many thanks