C-PLOT

Scientific Graphics and Data Analysis

10.2.2. - Argument substitution



The argument-substitution feature lets you pass arguments to the command file, making it possible to vary parameters each time you use the file. As C-PLOT reads the file, strings in the command file of the form $1, $2 and so on will be replaced by arguments entered with the do command. For instance, if the command file named cmd_file contains the lines
gd 2 data.$1
wi $2 $3 5 5
and you type on the command line do cmds 32 2 3, the plot program will get data from the file data.32 and place a 5cm × 5cm window 2cm from the left and 3cm from the bottom of the page.

Up to nine arguments may be passed to the command file on the command line. The variable $0 is replaced by the name of the command file. On the command line, arguments are separated by spaces, except that double quotes may be used to group several words as a single argument. Literal double quotes and dollar signs may be passed as \" and \$.