Pass php variable to exec
<p>I need to get dimm info using ipmitool as follows:</p>

<pre><code>exec("/usr/bin/ipmitool -I lan -H $spip -U root -P '$thepassword' sunoem cli 'show System/Memory/DIMMs/$a' | grep -i location", $dimm_loc, $ipmiretval);
</code></pre>

<p>$a is previously defined as:
 $a=$dimm[$i]</p>

<p>The return value for the above exec command is 1. If I replace $a with its vaule, i.e 
<code>exec("/usr/bin/ipmitool -I lan -H $spip -U root -P '$thepassword' sunoem cli 'show System/Memory/DIMMs/D5' | grep -i location", $dimm_loc, $ipmiretval);</code></p>

<p>The exec command executes as expected. So it looks like $a cannot be used in the above example. How else can I pass the variable to the exec command?</p>

<p>Thanks!!</p>
