title: can not replace path using sed
body: <p>i have this part of a code which finds and replaces strings from an associative array, the script is working when it is replacing strings but it is not working when the string is path.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>#!/bin/bash
  tomcatDirName="tomcat801"
  tomcatSvcName="tomcatSvc"
  tomcatSvcUser="tomcatUsr"
  tomcatSvcGrp="tomcatGrp"
  installationPath="/opt/app"
  tomcatDirPath="$installationPath/$tomcatDirName"
  initDTomcatFilePath="/root/scripts/tomcat801"
  javaDirName="java"
  javaDirPath="$installationPath/$javaDirName"
  jdkDirPath="$javaDirPath/jdk1.8.0_45"
  
  
  declare -A TomcatInitD=(
   ["^CATALINA_HOME.*"]="CATALINA_HOME=$tomcatDirPath"
   ["^TOMCAT_USER.*"]="TOMCAT_USER=$tomcatSvcUser"
   ["^TOMCAT_SVC.*"]="TOMCAT_SVC=$tomcatSvcName"
   ["^JAVA_PATH.*"]="JAVA_PATH=$jdkDirPath"
  )
  
  for i in "${!TomcatInitD[@]}"
  do
   value="${TomcatInitD[$i]}"
   key="$i"
   sed -i -e "s/$key/$value/" $initDTomcatFilePath
  done</code></pre>
  </div>
  </div>
  </p>
  
  <p>i am getting 2 lines of error on the 2 paths that i am trying to replace them.</p>
  
  <pre><code>sed: -e expression #1, char 35: unknown option to `s'
  sed: -e expression #1, char 27: unknown option to `s'
  </code></pre>
  
  <p>can any one tell me whats wrong or how to do it, many thanks.</p>