Project

General

Profile

« Previous | Next » 

Revision 8915

Added by Jing Tao about 10 years ago

Used variables to replace hard code in sed command. Also we have to escape the variables.

View differences:

src/scripts/bash/install-java7-tomcat7.sh
35 35
echo "the jk workers.properties location is $JK_WORKER_PATH"
36 36

  
37 37
echo "update the tomcat home and java home in workers.properties file"
38
sudo sed -i.bak --regexp-extended "s/(workers\.tomcat_home=).*/\1\/usr\/share\/tomcat7/;
39
                s/(workers\.java_home=).*/\1\/usr\/lib\/jvm\/java-7-openjdk-amd64/;"\
40
                $JKWORKERPATH
38
SAFE_TOMCAT_HOME=$(printf '%s\n' "$NEW_TOMCAT_HOME" | sed 's/[[\.*^$(){}?+|/]/\\&/g')
39
SAFE_JDK_HOME=$(printf '%s\n' "$NEW_JDK_HOME" | sed 's/[[\.*^$(){}?+|/]/\\&/g')
40
sudo sed -i.bak --regexp-extended "s/(workers\.tomcat_home=).*/\1${SAFE_TOMCAT_HOME}/;
41
                s/(workers\.java_home=).*/\1${SAFE_JDK_HOME}/;"\
42
                $JK_WORKER_PATH

Also available in: Unified diff