Next: , Previous: Backwards_compatibility, Up: gnuplot

1.6 Batch/Interactive Operation

`Gnuplot` may be executed in either batch or interactive modes, and the two may even be mixed together on many systems.

Any command-line arguments are assumed to be either program options (first character is -) or names of files containing `gnuplot` commands. The option -e "command" may be used to force execution of a gnuplot command. Each file or command string will be executed in the order specified. The special filename "-" is indicates that commands are to be read from stdin. `Gnuplot` exits after the last file is processed. If no load files and no command strings are specified, `gnuplot` accepts interactive input from stdin.

Both the exit and quit commands terminate the current command file and `load` the next one, until all have been processed.


To launch an interactive session:


To launch a batch session using two command files "input1" and "input2":

           gnuplot input1 input2

To launch an interactive session after an initialization file "header" and followed by another command file "trailer":

           gnuplot header - trailer

To give `gnuplot` commands directly in the command line, using the "-persist" option so that the plot remains on the screen afterwards:

           gnuplot -persist -e "set title 'Sine curve'; plot sin(x)"

To set user-defined variables a and s prior to executing commands from a file:

           gnuplot -e "a=2; s='file.png'" input.gpl