Re: command line assignment

From: Rick Grubin <grubin_at_nyahnyahspammersnyahnyah>
Date: Thu, 2 Nov 2006 10:27:30 -0700

Hi Jonathan,

>> I am trying to use the nifty new command line feature of NCL from
>> a shell script (bash). I'd like to preassign an NCL variable
>> before calling a script. But I want to assign the NCL variable
>> (basin) to the value of a shell script variable (shbasin) which
>> has already been defined previously. If I try this interactively I
>> get:
>>
>> --------------------------------
>> [vigh_at_euler]$ shbasin="atlantic"
>> [vigh_at_euler]$ echo $shbasin
>> atlantic
>> [vigh_at_euler]$ ncl basin=$shbasin
>> Copyright (C) 1995-2006 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 4.2.0.a034
>> The use of this software is governed by a License Agreement.
>> See http://www.ncl.ucar.edu/ for more details.
>> fatal: Assign: atlantic is undefined
>> fatal:Execute: Error occurred at or near line 1 in
>> file /tmp/ncl13631.ncl

Please try quoting as follows:

$ shbasin="atlantic"

$ ncl basin=\"$shbasin\"
Copyright (C) 1995-2006 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 4.2.0.a034
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
ncl 0> print(basin)

Variable: basin
Type: string
Total Size: 4 bytes
             1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) atlantic

-Rick.
----
Rick Grubin NCAR/CISL/VETS
Visualization + Enabling Technologies
grubin_at_ucar.edu 303.497.1832

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 02 2006 - 10:27:30 MST

This archive was generated by hypermail 2.2.0 : Thu Nov 02 2006 - 16:23:51 MST