newbie wants to call IDL from shell [message #61291] |
Fri, 11 July 2008 18:36 |
Tom Roche
Messages: 11 Registered: July 2008
|
Junior Member |
|
|
How to exec IDL procedures from a shell or other programming
environment? (Correctly: see failed attempt below.) Note that I'm not
talking about creating a runtime distribution; I just want to be able
to call a procedure from the OS commandline, not from the IDL
commandline, on a box with IDL installed. Why I ask:
My group mostly uses IDL to interact with netCDF files. I'm noticing
that, in scripts I've been given, we do a lotta code where we type in
literals to specify files on which to operate, e.g.
indir = '/path/to'
files = ['foo' , 'bar' , 'baz']
FOR i = 0, n_elements(files)-1 DO BEGIN
filename = files[i]
infile = indir+'/'+filename
doSomethingWith, infile
ENDFOR
I'd prefer to use IDL for things it does well, and use something more
general-purpose (e.g. bash, perl, python) (i.e. something I already
know how to use :-) to drive it, e.g.
# bash
for INFILE in $(bash fu) ; do
idl < doSomethingWith $INFILE
done
So I thought I'd start simple: I have a script (my first script that
does something useful!)
public1:/home/tlr/idl> ls -al regrid_mozt42_tlr.pro
> -rw-r--r-- 1 tlr m 755 Jul 10 16:11 regrid_mozt42_tlr.pro
public1:/home/tlr/idl> cat regrid_mozt42_tlr.pro
> COMPILE_OPT IDL2
> PRO regrid_mozt42_tlr
...
> END
done in the deprecated style above, which works from the IDL shell
with no args (because everything is literal within the *.pro):
public1:/home/tlr/idl> idl
> IDL Version 7.0 (linux x86 m32). (c) 2007, ITT Visual Information Solutions
> ...
> IDL> regrid_mozt42_tlr
> % Compiled module: REGRID_MOZT42_TLR.
> ...
> Done.
Now I just want to run it from the commandline, in the same directory
as above (which is in my IDL_DIR):
public1:/home/tlr/idl> idl < regrid_mozt42_tlr.pro
> IDL Version 7.0 (linux x86 m32). (c) 2007, ITT Visual Information Solutions
> ...
> PRO regrid_mozt42_tlr
> ^
> % Programs can't be compiled from single statement mode.
What do I need to do to make that work? Or how else should I do this?
Apologies if this is a FAQ but I haven't found any answers either
googling or in the online help. If I should RTFM, please pass pointer.
TIA, Tom Roche <Tom_Roche@pobox.com>
|
|
|