<html>
<body>
it should work, it doesn't matter if you export or not pref tw te, it <br>
would matter if grads was started by a subprocess, but is not the case. <br>
<br>
You should just transform your main script in a function <br>
<br>
Your grads script should start in this way: <br>
function main(args) <br>
pref=subwrd(args,1) <br>
tw=subwrd(args,2) <br>
te=subwrd(args,3) <br>
... <br>
return <br>
<br>
<br>
On Sun, 2020-03-08 at 18:31 -0800, Uma Bhatt wrote: <br>
<font color="#000000">> Hi Grads Users, </font><br>
<font color="#000000">>   </font><br>
<font color="#000000">>  I am trying to automate the processing, calculations, and plotting </font><br>
<font color="#000000">> of CFSv2 seasonal forecast products.  </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">>  I have to loop through different time values and file names of CFSv2 </font><br>
<font color="#000000">> files and it would be easier to loop through these in a bash shell. I </font><br>
<font color="#000000">> am sure you can do it all in grads but I am less clear on how to do </font><br>
<font color="#000000">> that.  </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">>  I am using this version of grads: </font><br>
<font color="#000000">> Config: v2.1.0 little-endian readline grib2 netcdf hdf4-sds hdf5 </font><br>
<font color="#000000">> opendap-grids,stn geotiff shapefile cairo </font><br>
<font color="#000000">> Issue 'q config' command for more detailed configuration information </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> In my script I loop through 8 ensemble members. The parameter name </font><br>
<font color="#000000">> provides the name of when the particular ensemble starts. The tstart </font><br>
<font color="#000000">> is the first time that I want to average over and tend is the last </font><br>
<font color="#000000">> time I want to average over. I want to use these three variables in </font><br>
<font color="#000000">> my grads script wind.gs (not included here for simplicity.  </font><br>
<font color="#000000">> I am stuck on the syntax of this line where I run the grads script. I </font><br>
<font color="#000000">> want to provide these three variables to wind.gs. I also call these </font><br>
<font color="#000000">> variables in this script using $pref, $tw, and $te (something that </font><br>
<font color="#000000">> works in fortran, but not here).  </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">>   grads -bpcx "run wind.gs $pref $tw $te” </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> I added an export statement in the upper part of the bash shell but </font><br>
<font color="#000000">> that did not work. I am sure I am doing something stupid.  </font><br>
<font color="#000000">> Thanks, </font><br>
<font color="#000000">> Regards, </font><br>
<font color="#000000">> Uma Bhatt </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">>  My script looks like this: </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> #!/bin/bash </font><br>
<font color="#000000">> #name=("0100" "0106" "0112" "0118" "0200" "0206" "0212" "0218") </font><br>
<font color="#000000">> #tstart=(28 27 26 25 24 23 22 21 ) </font><br>
<font color="#000000">> #tend=(55 54 53 52 51 50 49 48) </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> limit=1 </font><br>
<font color="#000000">> for ((nvar=0;nvar <= limit; nvar++)) </font><br>
<font color="#000000">> do </font><br>
<font color="#000000">> echo  "$nvar" </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> pref=${name["$nvar"]} </font><br>
<font color="#000000">> echo  "$pref" </font><br>
<font color="#000000">> tw=${tstart["$nvar"]} </font><br>
<font color="#000000">> echo  "$tw" </font><br>
<font color="#000000">> te=${tend["$nvar"]} </font><br>
<font color="#000000">> echo  "$te" </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> #export $pref </font><br>
<font color="#000000">> #export $tw </font><br>
<font color="#000000">> #export $te </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> cat << EOR > wind.gs </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> …….text snipped…... </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> EOR </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">>   echo "$pref" </font><br>
<font color="#000000">>   grads -bpcx "run wind.gs $pref $tw $te" </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> # nvar=$(($nvar+1)) </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> done </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> echo "Fin del script" </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> —————— </font><br>
<font color="#000000">> A brand is what a business does, reputation is what people remember. </font><br>
<font color="#000000">> - Ted Rubin </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> Uma S. Bhatt </font><br>
<font color="#000000">> Professor of Atmospheric Sciences & Geophysical Institute,  </font><br>
<font color="#000000">> Director Cooperative Institute for Alaska Research </font><br>
<font color="#000000">> physical location: Akasofu (IARC) Building (2158 Koyukuk Drive), </font><br>
<font color="#000000">> office location: Room 315 Akasofu </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> mailing address: </font><br>
<font color="#000000">> University of Alaska Fairbanks </font><br>
<font color="#000000">> Geophysical Institute </font><br>
<font color="#000000">> 2156 Koyukuk Drive                           </font><br>
<font color="#000000">> Fairbanks, Alaska  99775-7320 </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> tel: (907) 474-2662  fax: (907) 474-2643 </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> email: <a href="mailto:usbhatt@alaska.edu">usbhatt@alaska.edu</a> </font><br>
<font color="#000000">> web: <a href="http://ffden-2.phys.uaf.edu/usbhatt/">http://ffden-2.phys.uaf.edu/usbhatt/</a> </font><br>
<font color="#000000">>  </font><br>
<font color="#000000">> _______________________________________________ </font><br>
<font color="#000000">> gradsusr mailing list </font><br>
<font color="#000000">> <a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a> </font><br>
<font color="#000000">> <a href="http://gradsusr.org/mailman/listinfo/gradsusr">http://gradsusr.org/mailman/listinfo/gradsusr</a> </font><br>
<br>

<BR />
<BR />
<font face="Arial" color="#ff0000"><span style="font-size: 12px;">Attenzione ARPAL ha cambiato indirizzi digitali, i nuovi indirizzi di e-mail sono composti dall'attuale nome.cognome seguito da @arpal.liguria.it, quindi </span><b style>nome.cognome@arpal.liguria.it</b></font><BR />
</body>
</html>