Re: bringing arguments into an ncl script

From: Dennis Shea (shea AT XXXXXX)
Date: Thu Mar 01 2001 - 13:53:24 MST

  • Next message: Mary Haley: "question on "getenv" function"

    > I am running a couple of ncl scripts from a unix
    > shell script. I would like to be able to import
    > shell script variables into my ncl script. I tried
    > doing this but have been unsuccessful. Can this
    > sort of thing be done in ncl ? Any advice or
    > suggestions would be greatly appreciated.
    >

    Here is an example. If this does not help send again ...

    #!/bin/csh

    @ YR = 0
    @ YRSTOP = 13
    # Processes were put in background [&]
    while ($YR <= $YRSTOP )
        echo $YR
        setenv YEAR $YR
        ncl < demo.ncl >&! demo.output_$YR & # differemt output for each file
        @ YR = ($YR + 1)
    end
    exit

    Where the main script includes

    begin
      :
      :
     year = stringtointeger( getenv("YEAR"))
      :
      :
    end

    getenv: This function is used to retrieve the string value of a
            shell environment variable.
            
    I used stringtointeger to convert the string to an integer.

    Post again if this does not answer your question.



    This archive was generated by hypermail 2b29 : Thu Mar 01 2001 - 14:10:08 MST