# Shell

The shell command spawns an interactive shell. To return to gnuplot, type logout if using VMS, exit or the END-OF-FILE character if using Unix, or exit if using MS-DOS or OS/2.

There are two ways of spawning a shell command: using system command or via ! ($ if using VMS). The former command takes a string as a parameter and thus it can be used anywhere among other gnuplot commands, while the latter syntax requires to be the only command on the line. Control will return immediately to gnuplot after this command is executed. For example, in MS-DOS or OS/2,

         ! dir

or

         system "dir"

prints a directory listing and then returns to gnuplot.

Other examples of the former syntax:

          system "date"; set time; plot "a.dat"
          print=1; if (print) replot; set out; system "lpr x.ps"