scripting help needed
Guest wrote on Mar 03, 2006
Dear.
I deeply appreciate if someone can help me.
I'm writing a iraf script something like
----------------------------
slist(filename, >> "output")
wc "output" | fields ("STDIN", "6") | scan (num_aper)
---------------------------
(part of my script) and I got a following error message.
ERROR on line 309: Attempt to access undefined local variable
`num_aper'.
This script works fine with my laptop computer but
it does not work with my workstation with dual xeon processors.
(I'm using Suse 9.1 professional for both machines.)
Could you possibly tell me what causes this problem?
Thank you very much.
Jae-Woo Lee, Ph.D.
Assistant Professor
Dept. Astronomy & Space Science, Sejong University
98 Gunja-Dong, Gwangjin-Gu
Seoul, 143-747, Korea
T) 82-2-3408-3966
F) 82-2-3408-3916
Post generated using Mail2Forum (http://www.mail2forum.com)
I deeply appreciate if someone can help me.
I'm writing a iraf script something like
----------------------------
slist(filename, >> "output")
wc "output" | fields ("STDIN", "6") | scan (num_aper)
---------------------------
(part of my script) and I got a following error message.
ERROR on line 309: Attempt to access undefined local variable
`num_aper'.
This script works fine with my laptop computer but
it does not work with my workstation with dual xeon processors.
(I'm using Suse 9.1 professional for both machines.)
Could you possibly tell me what causes this problem?
Thank you very much.
Jae-Woo Lee, Ph.D.
Assistant Professor
Dept. Astronomy & Space Science, Sejong University
98 Gunja-Dong, Gwangjin-Gu
Seoul, 143-747, Korea
T) 82-2-3408-3966
F) 82-2-3408-3916
Post generated using Mail2Forum (http://www.mail2forum.com)
Mike Fitzpatrick wrote on Mar 03, 2006
slist(filename, >> "output")
wc "output" | fields ("STDIN", "6") | scan (num_aper)
---------------------------
(part of my script) and I got a following error message.
ERROR on line 309: Attempt to access undefined local variable
`num_aper'.
I'm not quite sure I understand your intention in the code snippet: The SLIST task produces a table where column 6 is the starting wavelength, but the 'wc' ouput only has four values in most cases. This means the FIELDS output should be empty and so 'num_aper' isn't defined and would account for the error. If all you want to do is count the number of lines of output from SLIST you could do it as
slist (filename) | count ("STDIN") | scan (num_aper)
To make sure the value was read you can use the nscan() afterward to verify at least one value was scanned.
I can't explain why it works on one machine and not the other, the 'wc' should produce only 4 columns in an case. Hope this helps.
Cheers,
-Mike
Last post on Mar 03, 2006