title: Need to change $1 value to $1 variable in a shell script
body: <p>I am writing a shell script which is using a environment variable.</p>
  
  <p>The environment variable has $1 set in the value. When I am using the env variable in the script, I need to use the $1 as the parameter passed from the script arguments.</p>
  
  <p>Example:</p>
  
  <pre><code>export EXPORT_VAR="-DmyVariable=\$1"
  </code></pre>
  
  <p>In a shell script (myScript.sh), I have used the above env variable like below.</p>
  
  <pre><code>#!/bin/bash
  
  exec $JAVA_HOME/bin/java $EXPORT_VAR com.myProject.myJob "$@"
  </code></pre>
  
  <p>I am running the script as follows:</p>
  
  <pre><code>./myScript.sh var1 var2
  </code></pre>
  
  <p>I want the following command to be executed</p>
  
  <pre><code>exec $JAVA_HOME/bin/java -DmyVariable=var1 com.myProject.myJob "var1 var2"
  </code></pre>
  
  <p>Please advise.</p>
  
  <hr>
  
  <p>$1 is just an example. The environment variable can have $2....$N. The same variable should be assigned to -DmyVariable while execution</p>