[gradsusr] rc and result variables

Jeff Duda jeffduda319 at gmail.com
Mon May 13 15:54:01 EDT 2013


This is discussed in the grads scripting language page as follows:

"The expression is evaluated, and the resulting string is then submitted to
GrADS as a command for execution. The script variable rc will contain the
return code from the GrADS command (this will always be an integer value).
In addition, any text output from GrADS in response to the command is put
in the variable result for examination by the script. A GrADS error
resulting from an invalid command WILL NOT terminate execution of the
script."

This means that when you run a command in the equivalent command line
prompt mode (i.e., surrounded with quotes) the output, which would normally
be printed to the screen if you were running the command at the grads
prompt would instead be stored in a variable called "result".  You can then
use some commands to capture parts of that variable to use in your script.
The best way to see what it contains is to include the line

say result

immediately after any command in your script that may produce graphics or a
computation.  rc on the other hand returns an integer value detailing the
success or failure of a certain command to properly run.  I think usually
rc = 0 means the command ran properly with no errors, whereas a nonzero
code will give you an indication of what type of error occurred.  You can
thus use rc for error handling in your script.

Hope this helps.

Jeff Duda


On Mon, May 13, 2013 at 2:44 PM, leonardo <leoclarke at yahoo.com> wrote:

> Dear GrADS Users
>
> Can anyone give me some details on  the "rc" and "result" variables in
> GRADS?
>
> What are their purpose?
> How they are used in scripting?
>
> Regards
> LC
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130513/32105fb1/attachment-0003.html 


More information about the gradsusr mailing list