and then uses the Stream Editor (sed) to use this variable : -if [ -z "$1" ]thenecho "For what product are you creating this ?"exit 1fi
Sadly, this didn't quite work ....sed -i'' 's/PidFile\ logs/PidFile\ ${Product}\/logs/g' /opt/ibm/HTTPServer/${Product}/conf/httpd.confsed -i'' 's/ErrorLog\ logs/ErrorLog\ ${Product}\/logs/g' /opt/ibm/HTTPServer/${Product}/conf/httpd.confsed -i'' 's/CustomLog\ logs/CustomLog\ ${Product}\/logs/g' /opt/ibm/HTTPServer/${Product}/conf/httpd.conf
Instead, I ended up with this: -
rather than this: -PidFile ${Product}/logs/httpd.pid
Thankfully, it was a quick fix - I just needed to change my Bash script to this: -PidFile WAS/logs/httpd.pid
sed -i'' "s/PidFile\ logs/PidFile\ ${Product}\/logs/g" /opt/ibm/HTTPServer/${Product}/conf/httpd.confsed -i'' "s/ErrorLog\ logs/ErrorLog\ ${Product}\/logs/g" /opt/ibm/HTTPServer/${Product}/conf/httpd.confsed -i'' "s/CustomLog\ logs/CustomLog\ ${Product}\/logs/g" /opt/ibm/HTTPServer/${Product}/conf/httpd.conf
In other words, I replaced the single quotes around the s/from/to/g section of the Sed script with double quotes ....
Thanks to this: -
How do I use variables in a sed command?
for inspiration.
No comments:
Post a Comment