[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.22 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, `endcli` if using AmigaOS, 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 AmigaOS, 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" |
On an Atari, the `!` command first checks whether a shell is already loaded and uses it, if available. This is practical if `gnuplot` is run from `gulam`, for example.