NAME do - execute a command file
SYNOPSIS do
[file_name]
[args]
DESCRIPTION Command files are used to run
C-PLOT in batch mode or to store commands that
will be used often. Command files consist of an ASCII list of
commands and newlines entered in the same sequence and format
that you would use to type them at the keyboard when using the
program interactively. (For information on creating command
files, see the
mk command.)
When do file_name is
entered, if file_name isn't found in the
current directory (and file_name doesn't
contain a / character), the alternate command file
directory given by the shell variable CPLOT_DO_DIR
(or set using the se do_dir command) is checked for
the file. The string value of the alternate command file
directory may actually be a colon-separated list of directories,
in which case each directory is checked in turn for the file.
The default alternate command file directory is
$CPLOTHOME/cmdfiles.
If the argument file_name is the single
character ., the same file as last time is used.
The do command changes the prompt from
|
|
(The number 1 indicates the level of nesting; command files can
be nested four deep.) Commands read from the command file will
be echoed on the terminal as they are read and executed.
Up to nine arguments can be passed to a command file. Within
the command file, you refer to the arguments as $1,
$2, etc., where $1 refers to
the first argument, $2 to the second and so
on. The name of the command file is $0.
Arguments on the command line are separated by spaces or tabs.
For instance, if the command file named cmds contains
the lines
| -
gd 2 data.$1
wi $2 $3 5 5
|
and you type do cmds 32 2 3 on the command line,
C-PLOT will get data from the file data.32
and place a 5 cm x 5 cm window 2 cm from the left and 3 cm
from the bottom of the page.
You can use double quotes (") to include several
words in one argument. Use \$ or
\" to pass literal dollar signs or double quotes to
the command file.
If the exit command ex is encountered in a
command file, the program will exit. An end-of-file (or
^D) from the command file returns the program to the
previous input mode. Typing ^C during execution of
a command file will terminate execution. The PLOT->
prompt will reappear and subsequent input will be taken
from the keyboard.
Certain errors also will bring back the PLOT->
prompt, such as trying to initialize a non-existent filter
with zi. Within user functions, you can also abort
a command file by setting
|
|
within the C code.
A command file can be run when C-PLOT is
first invoked by giving the name of the file as an argument in
the shell command line.
When invoking type 5 (fitting) user functions from a command
file, you can arrange to have the fitting function read commands
from file_name for a while and then have
control returned to the C-PLOT plotting program.
If file_name contains the lines
|
|
or (to use the same fitting function as last time)
|
|