source `which tsargs` set file-list = ( `getfiles` ) set scalar-var = `getparam -p param-name [ -r | -d default-value ]` set vector-var = ( `getparam -p param-name [ -r | -d default-value ]` )
These tools can be used in C-shell scripts for processing TeraScan style argument lists:
function param1=value1 ... paramN=valueN file1 ... fileM
The tsargs file defines the getfiles and getparam aliases based on the tsparam function:
alias getparam 'tsparam \\!* $argv:q' alias getfiles 'tsparam -f $argv:q'
Depending on its options, tsparam writes filenames or parameter values to UNIX stdout.
The following parameters are specific to tsparam.
Causes the list of files at the end of the argument list to be written to UNIX stdout. tsparam
exits with status 1 if the argument list is found to be invalid. This option can not be
used with any other option.
Causes tsparam to report an error and exit with status 1 if no value for the
parameter is supplied in the argument list.
The following example extracts two required parameters (num_lines and num_samples) and one optional vector-valued parameter (var_names) from the argument list. getfiles is used first in order to validate the argument list.
#! /bin/csh -f source `which tsargs` set FILES = ( `getfiles` ) if ($status == 1) exit 1 set LINES = `getparam -p num_lines -r`; if ($status == 1) exit 1 set SAMPLES = `getparam -p num_samples -r`; if ($status == 1) exit 1 set VARS = ( `getparam -p var_name` )
Last Update: $Date: 1999/05/10 20:46:48 $