! The "false" is the default value if no argument is supplied.
! Anything else ("*") translates to "true".
let narg = 0
if $1"false|*>true" then let narg = 1 endif
if $2"false|*>true" then let narg = 2 endif
if $3"false|*>true" then let narg = 3 endif
if $4"false|*>true" then let narg = 4 endif
if $5"false|*>true" then let narg = 5 endif
...
list narg
Or, here's an answer to a similar question you asked a while back.
http://ferret.wrc.noaa.gov/Ferret/Mail_Archives/fu_2001/msg00009.html
One might be able to work out something using the PPL edit commands
in
Appendix B, section 7 of the users guide - maybe the $ELEMENT function,
perhaps along with the $LENGTH function could be used to work out a
way to parse the result of the concatenated arguments and find out
how many
arguments there are.
Ansley Manke
Gary Strand wrote:
I don't recall if I asked this once before.I'd like to use a go script with a variable number of args (up to 99 under 5.4,
IIRC). For example:yes? go plot X A B C D ! will plot field X from files A, B, C, and D
yes? go plot X A D B ! will plot field X from files A, B, and D only
yes? go plot X A ! will plot field X from file A onlyIs there a straightforward way (akin to csh's "$#argv") to get the number of
args and then parse them (akin to $argv[1..N]) in FERRET?Or would I be better off just building the 'go' script via perl or csh? Thanks.
--
/\ Gary Strand (303) 497-1336 NCAR ML262A
\_][ www.cgd.ucar.edu/ccr/strandwg 1850 Table Mesa Dr
\___strandwg@ucar.edu Boulder, Colorado, USA 80305
--
Ansley Manke Pacific Marine Environmental Laboratory Seattle
WA (206)526-6246