Welcome to iraf.net Friday, April 28 2017 @ 09:51 PM GMT

 Forum Index > Help Desk > General IRAF New Topic Post Reply
 implementing cl commands into shell script
 04/14/2017 08:20PM (Read 118 times)  

Status: offline

Registered: 04/14/2017
Posts: 1
Hi all,

I am new to IRAF scripting and I have a problem regarding implementing IRAF tasks into a shell script. The script should work with fits files and is very simple, but it has to use IRAF tasks together with bash. The script is as follows:

for i in $( ls ???.fits )
rename s/.....$// $i


for i in $( ls ??? )

mv $i "$i"_6.fits


How can I add the cl commands like imcopy (at the beginning of the script) ) and imarith (at the end), so I could run them from bash?


Profile Email
 04/25/2017 04:06PM  

Status: offline

Registered: 09/30/2005
Posts: 3955
IRAF commands are intended to be run from the CL interface since that is what handles things like parameter passing, graphics rendering, etc. IRAF scripts *can* be executed as host level commands (see http://iraf.noao.edu/iraf/web/new_stuff/cl_host.html) and for a simple script such as your example it may be easier to write a CL script than to try to call IRAF binaries directly.

You can call IRAF tasks from unix so long as you know the path to the binary containing the task and can supply the parameters, however this doesn't usually work well for any graphics or interactive tasks or tasks which require iraf environment variables (e.g. the "dev$pix" test image won't resolve the 'dev$' part of the path normally). For example, to run IMCOPY you could use the command:

/iraf/iraf/bin.linux64/x_images.e imcopy input=foo.fits output=bar.fits verbose=no

For tasks with many parameters it is easier to supply the params using the @-file syntax, e.g. in the CL you can dump the params with:

cl> dpar imcopy > imcopy.par

Then edit the 'imcopy.par' file with your values and execute the task as

/iraf/iraf/bin.linux64/x_images.e imcopy @/path/imcopy.par

where you would substitute the iraf path and architecture name appropriate for y
our system.

Information on CL scripting can be found at http://iraf.net/irafdocs/script/

Profile Email
Content generated in: 0.13 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies

Privacy Policy
Terms of Use

User Functions