Execute a command of the operating system
This functionality does not run in MATLAB.
! command system(command)
system("command") executes a command of the operating system or a program, respectively.
!command is equivalent to system("command"):; note that !command will suppress output of its return value.
The syntax !command is allowed during interactive input only, not when reading MuPAD® input from a file. "!" must be the first character on the input line.
system is not available in all MuPAD versions. If not available, a call to system results in the following error message:
Error: Function not available for this client [system].
system("command") sends the command to the operating system. E.g., this command may start another application program on the computer. The return value 0 indicates that the command was executed successfully. Otherwise, an integer error code is returned which depends on the operating system and the command.
If the called command writes output to stderr on UNIX® systems, the output will go to the MuPAD stderr. Outputs on the standard output channel will be inserted in the command's output, but are not accessible programmatically.
On a UNIX system, the date command is executed. The command output is printed to the screen, the error code 0 for successful execution is returned to the MuPAD session:
errorcode := system("date"):
Fri Sep 29 14:42:13 MEST 2000
Now the date command is called with the command line option '+%m' in order to display the current month only:
errorcode := system("date '+%m'"):
Missing the prefix '+' in the command line option of date, date and therefore system returns an error code. Note that the error output goes to stderr:
system("echo communication example > comm_file"): ftextinput("comm_file")
system("rm -f comm_file"):
A command of the operating system or a name of a program as a MuPAD character string