<div dir="ltr">Hi,<div><br></div><div>I am using NCL to calculate a few terms for an optimization algorithm and I am calling the NCL function from within a &#39;while loop&#39; in a bash script. The &#39;while loop&#39; runs till a certain condition is met and for the condition to be met, the bash script needs to accept a new value for an existing variable from the NCL script. I have tried using system, systemfunc with even the export command but nothing seems to work. The code looks as follows:</div><div><br></div><div>------------------------------------------</div><div>#!/bin/bash<br></div><div><br></div><div><div>w1=0.4</div><div>dw1=0.1</div></div><div>inc=0.001</div><div><br></div><div>while awk &#39;BEGIN { if (&#39;$dw1&#39;&lt;&#39;$inc&#39;) {exit 1}}&#39;; do<br></div><div><br></div><div><div>cat &lt;&lt;&#39;EOF&#39; &gt;&gt; opti.error.ncl</div></div><div><br></div><div>;;;;Perform certain computations on w1 and update the w1 and dw1</div><div>w1=nw1</div><div>dw1=ndw1</div><div><br></div><div><div>      system(&quot;w1=&quot; + w1)</div><div>      system(&quot;dw1=&quot; + dw1)</div></div><div><br></div><div>;;;;w1 and dw1 need to be passed to the bash script</div><div><br></div><div>EOF</div><div><br></div><div><br></div><div> ncl k1=${w1}  dw11=${dw1}  opti.error.ncl<br></div><div><br></div><div>echo $w1</div><div>echo $dw1</div><div><br></div><div>done</div><div>------------------------------------------<br></div><div><br></div><div>But this does not update w1 and dw1 values. Any input would be greatly appreciated.</div><div><br></div><div>Thanks,</div><div>Abheera</div><div><br></div><div><br></div></div>