Some commands that will help you manage packages are:
Loading Packages
In IRAF terminology, a command or program is called a task and logically-related tasks are grouped together in a package. Before you can use a task, its package must be loaded.
Loading Packages
Note that many packages, including TABLES and its packages, are implicitly loaded when the STSDAS package is loaded. See the diagram on page 25.
Normally, you would also specify values for any required parameters on the command line when you run the task, however, you don't need to. If you start a task by simply typing its name, the task will prompt you for any required information, such as the names of input files, starting values, etc. Note that minimum matching is used for task and parameter names; this means that you need only type enough characters to uniquely identify the task or parameter name, for example, instead of typing the full task name eparam, you need only type epar.
The use of parameters is an important concept and will be discussed in the next section.
The two most useful commands for handling parameters are:
Displaying Parameter Settings with lpar
If you type an invalid value for a parameter, epar has some error checking capability and will display an error message. For example, the message might say "Parameter Value is Out of Range." The message is displayed when you move to another parameter or if you press
. Parameter types are listed in Table 2.1.
Parameter Data Types
To display the current setting for an environment variable, use the
show command. Typing show by itself will display all environment variables, typing the name of a variable on the command line will show only the setting for that variable. For example, if you wanted to see which printer your printer environment variable was set to use, you would type the following command:
Generated with WebMaker
Running a Task
Run a task by typing its name. Background Tasks
To run a task as a background job, freeing your workstation window for other work, add an ampersand (&) to the end of the command line. For example:
cl> taskname &
When you use background jobs, you would typically redirect your output and any possible error messages to a file (as explained below) to prevent the background task output from interfering with your interactive session. For example:
cl> taskname >& task.out &
Escaping System Level Commands
To run an operating system-level command (i.e., Unix or VMS commands) from within the IRAF CL, precede the command with an exclamation point (!). This is called escaping the command. For example:
cl> !system_command
Piping and Redirection
You can run tasks in sequence, with the output of one task being used as the input for another. This is called piping and is done by separating commands with a vertical bar (|). For example:
cl> command filename | task2
You can also save output from any task or command to a file by using the greater-than symbol (>), for example:
cl> command > outputfile
You can also direct both the standard task output (called STDOUT) and any error messages (called STDERR) to a file by appending an ampersand to the greater-than symbol, for example:
cl> command >& outputfile
Batch Jobs
You can submit tasks to run as batch jobs (usually tasks that would take a long time to run and that don't require user interaction) using the &batch syntax, for example:
cl> task >& outfile &batch
Setting Parameters
Information is provided to tasks through parameters. Parameters are used to specify names of input or output files, starting or ending values, option settings, and many other types of information that controls the behavior of the task.
Parameters can be set in several ways:
cl> task.parameter="value"
cl> task parameter_value hidden_par=value
Parameters on the Command Line: Positional and Hidden
There are two types of parameters that you would set from the command line when running tasks:
cl> imcopy oldimage.hhh copy.hhh
fi> strfits mta 1-3 images blank=-1
Viewing Parameters with lpar
The lpar command lists the current parameter settings for a given task (Figure 2.2).
Setting Parameters with epar
The epar command is an interactive parameter set editor. All of the parameters and their current settings are displayed on the screen and you can move around the screen using the arrow keys (also called cursor keys) and can type new settings for any parameters you wish to change. Figure 2.3 shows a sample of the epar editor at work.
Editing Parameters with epar
fi> epar strfits
Parameter Data Types--What to Specify
Parameters are either required or hidden, and each parameter expects information of a certain type. Usually, the first parameter is required, and very often it expects a file name. Parameters are described in the help file for each task. When a parameter is shown in parentheses (either in the help file or in the lpar listing), the parameter is hidden.
Restoring Parameter Default Values
Occasionally, IRAF will get confused by your parameter values. If this happens, you can restore the default parameters with the unlearn command, which restores the default parameter values. You can use unlearn on either a task or on an entire package.
The unlearn command can be used if you start having problems with IRAF or STSDAS. Parameter conflicts are the most common source of trouble for the new user.
Setting Environment Variables
IRAF uses environment variables to define which devices are used for certain operations. For example, your terminal type, default printer, and disk and directory used for storing images are all defined through environment variables. Environment variables are set using the
set command. Table 2.2 lists some of the environment variables that you might want to change along with examples of how they are used.
st> show printer
Environment Variables
The show command is especially useful for setting variables to long directory path names.