tsargs, tsparam, getparam, getfiles - Process TeraScan style argument lists in C-shell scripts

SYNOPSIS

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 ]` )

DESCRIPTION

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.

PARAMETERS

The following parameters are specific to tsparam.

-f


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.

-p param-name
Causes the value for the given parameter to be written to UNIX stdout.
-d default-value
Causes tsparam to write the default value to UNIX stdout and exit with status 2 if no value for the parameter is supplied in the argument list.
-r


Causes tsparam to report an error and exit with status 1 if no value for the parameter is supplied in the argument list.

EXAMPLES

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 $