An alternative to typing commands interactively into dynagraph is reading a prepared dynagraph script from a file.
A dynagraph script can be read during an interactive
session using the read
command:
read
filename
;read(
filename
);
Two two forms of the command are equivalent; the first one is provided for compatibility with Maple.
In either case, dynagraph reads its input from the contents
of the specified file rather than from the terminal.
Lines from the file are read and executed just as if
there were typed at the terminal. Blank lines are
ignored. Everything from a `#'
character
to the end of line is considered a comment and discarded.
The filename
argument must be quoted if it contains
other than alphanumeric characters. See the section
Quoted Strings for details.
Example:
> read somefile; > read "somefile.dg"; > read("/usr/home/dir/somefile.dg");
Dynagraph can be used as a "compute engine" in a non-interactive mode to process script files. For this, invoke dynagraph from the Unix command line as:
% dynagraph < scriptfilewhere `
%
' indicates the Unix shell prompt
and scriptfile
is a file containing the
sequence of dynagraph commands to be executed,
like those described in the section above.
Dynagraph will read and execute each line from the
file as if they were typed at the terminal.
Dynagraph exits when the end of file is reached.
Typically the file will contain a savegraph()
command (see Saving Images to Files)
to generate and save a graph or graphs in some
format into a file.
In the current implementation, each line read from
scriptfile
is echoed to the screen. If
this is found annoying, redirect the output to
/dev/null
, as in:
% dynagraph <scriptfile >/dev/null