Nicola Caon - Instituto de Astrofisica de Canarias

Back to the IRAF page Go to Nicola Caon's Home Page Go to the IAC's Home Page




How to define and store a cl script




  • Define the script
  • Syntax:
     task  name = /path/name.cl 
    Notes:
  • Task name, rootname of the file and the name of the procedure must be the same
  • If the procedure has no task parameters, place a $ in front of the task name, i.e.
     task  $name = /path/name.cl 
  • Examples:
     cl> task skysub = /home/ncaon/iraf/scripts/skysub.cl
     cl> task pol = scripts$pol.cl 
    (assuming "scripts" has been defined as the directory above)


  • Simple way to store and organize your scripts
  • This is the most straightforward method to organize your script, and have them ready whenever your enter IRAF
    Step 1: Place your scripts in a common directory, say /home/yourname/iraf/scripts/
    Step 2: Add the task definitions to your loginuser.cl file.
    So, for instance, the loginuser.cl file will contain the following lines:
    set scripts = /home/yourname/iraf/scripts/
    task skysub = scripts$skysub.cl
    task pol    = scripts$pol.cl


  • Store and organize your scripts in a package
  • This is a more elegant way of organizing your scripts. You create a new package, whose tasks are the scripts you have written.

    Step 1: Place all scripts in a common directory, say /home/yourname/iraf/scripts/
    Step 2: Create a package script, i.e. a file - say scripts.cl - which will contain the scripts definition. An example of scripts.cl:
    # scripts package definition
    
    package scripts
    
    task skysub = scripts$skysub.cl
    task pol    = scripts$pol.cl
    
    clbye() 
    Step 3: Add the following lines to your loginuser.cl file
    set scripts = /home/yourname/iraf/scripts/
    task scripts.pkg = scripts$scripts.cl 
    Step 4: Now you can load your own package:
    cl > scripts
    skysub   pol