Executing operating system commands
Operating system commands are accessible from the Interactive Optimizer.
The execute command (xecute)
is simple but useful. It executes operating system commands outside
of the CPLEX environment. By using xecute,
you avoid having to save a problem and quit CPLEX in order to carry
out a system function (such as viewing a directory, for example).
As an example, if you wanted to check whether all of
the files saved in the last session are really in the current working
directory, the following CPLEX command shows the contents of the current
directory in a UNIX operating system, using the UNIX command ls:
xecute ls -l
total 7448
-r--r--r-- 1 3258 Jul 14 10:34 afiro.mps
-rwxr-xr-x 1 3783416 Apr 22 10:32 cplex
-rw-r--r-- 1 3225 Jul 14 14:21 cplex.log
-rw-r--r-- 1 145 Jul 14 11:32 example
-rw-r--r-- 1 112 Jul 14 11:32 example.bas
-rw-r--r-- 1 148 Jul 14 11:32 example.lp
-rw-r--r-- 1 146 Jul 14 11:32 example2
After the command is executed, the CPLEX> prompt
returns, indicating that you are still in CPLEX. Most commands that
can normally be entered from the prompt for your operating system
can also be entered with the xecute command.
The command may be as simple as listing the contents of a directory
or printing the contents of a file, or as complex as starting a text
editor to modify a file. Anything that can be entered on one line
after the operating system prompt can also be executed from within
CPLEX. However, this command differs from other CPLEX commands in
that it must be entered on a single line. No prompt will be issued.
In addition, the operating system may fail to carry out the command.
In that case, no message is issued by the operating system, and the
result is a return to the CPLEX> prompt.
Summary
The general syntax for the xecute command
is:
xecute command line