Next: , Previous: reset, Up: Commands


3.23 save

The save command saves user-defined functions, variables, the `set term` status, all `set` options, or all of these, plus the last `plot` (`splot`) command to the specified file.

Syntax:

           save  {<option>} '<filename>'
     

where <option> is functions, variables, terminal or `set`. If no option is used, `gnuplot` saves functions, variables, `set` options and the last `plot` (`splot`) command.

saved files are written in text format and may be read by the `load` command. For save with the `set` option or without any option, the terminal choice and the output filename are written out as a comment, to get an output file that works in other installations of gnuplot, without changes and without risk of unwillingly overwriting files.

terminal will write out just the terminal status, without the comment marker in front of it. This is mainly useful for switching the terminal setting for a short while, and getting back to the previously set terminal, afterwards, by loading the saved terminal status. Note that for a single gnuplot session you may rather use the other method of saving and restoring current terminal by the commands `set term push` and `set term pop`, see `set term`.

The filename must be enclosed in quotes.

The special filename "-" may be used to save commands to standard output. On systems which support a popen function (Unix), the output of save can be piped through an external program by starting the file name with a '|'. This provides a consistent interface to `gnuplot`'s internal settings to programs which communicate with `gnuplot` through a pipe. Please see help for `batch/interactive` for more details.

Examples:

           save 'work.gnu'
           save functions 'func.dat'
           save var 'var.dat'
           save set 'options.dat'
           save term 'myterm.gnu'
           save '-'
           save '|grep title >t.gp'