View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

executing a file in IRAF

cosmologist wrote on Apr 22, 2009

Hi,
How do you execute a file in iraf?
let's say the file is file.cl
It says that to execute it I should type:

cl < file.cl
but that doesn't work... I tried [ cl < file.cl , < file.cl, file.cl ] but nothing works, what's the correct form?

Thanks!

Jason Quinn wrote on Apr 22, 2009

If you are using a modern installation of IRAF, try

ecl < file

Note that if your file doesn't load the usual login files, then it is a very bare bones environment. Try doing the same thing from within IRAF and it might work better.

Jason

Mike Fitzpatrick wrote on Apr 22, 2009

The reason you're having problems may depend on what exactly is in the 'file.cl'. Jason is right that syntax of the form "cl < file" will execute the contents of the file but implicit in that is the assumption that 'file' contains valid IRAF commands and you are executing this after you've already logged into the CL. From the unix command-line, what you're redirecting to is the 'cl' startup script which may or may not execute the file the way you expect. If you're interested in writing scripts that execute from the host prompt, see http://iraf.noao.edu/iraf/web/new_stuff/cl_host.html for more information.

If 'file.cl' is a procedure script, normally you would declare it as a new task, e.g.

cl> task foo = /path/foo.cl


and then execute the task 'foo' (or declare it as "task $foo = ...." if there are no parameters, i.e. no variables declared before the 'begin' statement).

Also note that when executing a file of commands with redirection, all input is redirected. This means that parameter prompts or other input won't be read from the terminal but from the redirected file itself (i.e. the next line of the file responds to the prompt). If you could post more about what your file looks like, and specifically why you think it isn't working, we might have other comments.

Cheers,
-Mike

cosmologist wrote on Apr 22, 2009

I opened the file and I see that it starts with "capall"... I thought it's a task, so I wanted to see in which package I can find it... but it looks like it's not [help capall give an error message].
Does anyone know what capall is?

cosmologist wrote on Apr 22, 2009

Also, a traditional way to identify the problem in a C++ program for example is to put random "cout<< " here and there and check which ones are executed before the error happens, so I am wondering if tere is something equivelent to cout<< in iraf?
(if someone would know what capall is that would be much easier.)
Thanks a lot

Mike Fitzpatrick wrote on Apr 22, 2009

It's either something local, or else a typo for the APALL package, but 'capall' isn't anything I've head of.

-Mike

Last post on Apr 22, 2009