Source script in bash with $ character present in the script
<p>When tomcat starts up, it checks for $CATALINA_HOME/bin/setenv.sh and if it exists, it sources this file as shown below</p>

<pre><code>. $CATALINA_HOME/bin/setenv.sh
</code></pre>

<p>Following are the contents of my setenv.sh file</p>

<pre><code>JAVA_OPTS="$JAVA_OPTS -Daccesskey=abc$def"
</code></pre>

<p>When it is sourced, the value "<strong>-Daccesskey=abc$def</strong>" is being read as "<strong>-Daccesskey=abcdef</strong>". Character <strong>$</strong> is gone.</p>

<p>I am generating the setenv.sh file. How should i specify the contents of setenv.sh such that i read the value "<strong>abc$def</strong>"?</p>