Passing parameters into a script

Stephen R McMillan smcmillan at PLANALYTICS.COM
Thu May 4 10:50:29 EDT 2006


Herb,
I use GrADS 1.8SL11 on a PC (Windows XP), and your script works fine on my 
machine. Script I used, called testfunc.gs...

function main(args)
  arg0=subwrd(args,1)
  arg1=subwrd(args,2)
  arg2=subwrd(args,3)
  say 'arg0='arg0 '  arg1='arg1 '  arg2='arg2
return

Following is sample command line entry, and result of "say"  string:

> testfunc 04may2006 slp 500
arg0=04may2006   arg1=gph   arg2=500

Note, I get the same output regardless of whether "return" is at the end 
of this simple script.

However, I have a feeling this does not address your problem, or does it?

Stephen McMillan
Planalytics, Inc.
:



Eric Salathé <salathe at WASHINGTON.EDU> 
Sent by: GRADSUSR at LIST.CINECA.IT
05/03/2006 05:53 PM
Please respond to
GRADSUSR at LIST.CINECA.IT


To
GRADSUSR at LIST.CINECA.IT
cc

Subject
Re: Passing parameters into a script





Herb-

Your script works as expected in version 1.9b4 on linux. So this may be
a PC GrADs issue...

-Eric


On May 1, 2006, at 11:13 AM, Herb Philbrick wrote:

> Hello all,
>
> I am unable to use parameters passed into a script and would very much
> appreciate some guidance or an example.
>
> I see from the .pdf doc that there are two ways of invoking a script.
>   - using EXEC allows for 10 arguments referred to as &0-&9 in the
> script
> (p49)
>   - using RUN does not allow for &0-&9 and I'm not sure how the
> arguments
> are received. (p52)
>
> Apparently, EXEC does not accommodate the full scripting language, so
> RUN is
> my focus.
>
> The sample script meteogram_avn.gs has  * function main(args) *  as its
> first executable line.  "args" is parsed to find individual arguments.
> There is no  * return *  statement matching the  * function main(args)
> *
> statement.
>
> I have tried a simple script along the lines of:
>         function main(args)
>         arg0=subwrd(args,1)
>         arg1=subwrd(args,2)
>         arg2=subwrd(args,3)
>         say 'arg0='arg0 '  arg1='arg1 '  arg2='arg2
>
> The script bombs on the first line.  (PCGrADS 1.8)
>
>         I have tried searching the archives but, I haven't been able
> to gain
> access, even after registering in numerous manners.
>         A tip on accessing the archives would be greatly appreciated,
> too.
>
>
> Thank you,
>
> Herb Philbrick
>      Burns Harbor Plate
>      voice 219-787-3321
>      fax    219-787-2690
>      herb.philbrick at mittalsteel.com
>
>
--
Eric Salathé
Climate Impacts Group             <salathe at washington.edu>
University of Washington
<http://www.atmos.washington.edu/~salathe>

************************************************************************
The information contained in this e-mail message is intended only for the 
personal and confidential use of the recipient(s) named above and may 
contain information that is privileged, confidential, and/or proprietary 
to Planalytics, Inc. and its subsidiaries and affiliated companies.  This 
message may be an attorney-client communication and as such is privileged 
and confidential.  If the reader of this message is not the intended 
recipient or an agent responsible for delivering it to the intended 
recipient, you are hereby notified that you have received this document in 
error and that any review, dissemination, distribution, or copying of this 
message is strictly prohibited.  If you have received this communication 
in error, please notify the sender immediately by e-mail, and delete the 
original message.
************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20060504/945cb6bd/attachment.html 


More information about the gradsusr mailing list