Shell commands may be executed directly from within PyXPlot by prefixing them with an ! character. The remainder of the line is sent directly to the shell, for example:
!ls -l
Semi-colons cannot be used to place further PyXPlot commands after a shell command on the same line.
|
!ls -l ; set key top left |
It is also possible to substitute the output of a shell command into a PyXPlot command. To do this, the shell command should be enclosed in back-quotes (‘), as in the following example:
a=`ls -l *.ppl | wc -l` print "The current directory contains %d PyXPlot scripts."%(a)
It should be noted that back-quotes can only be used outside quotes. For example,
|
set xlabel ’‘ls‘’ |
will not work. The best way to do this would be:
|
set xlabel ‘echo "’" ; ls ; echo "’"‘ |
Note that it is not possible to change the current working directory by sending the cd command to a shell, as this command would only change the working directory of the shell in which the single command is executed:
|
!cd .. |
PyXPlot has its own cd command for this purpose, as well as its own pwd command:
|
cd .. |