RunExternalCommand¶
runextcmd.spad line 73 [edit on github]
RunExternalCommand provides an interface to run an external command and capture its standard output. Examples: run("ls .spad”, ``””``, ``””``) run(“ls”, ``””``, ``”*``.spad|sed ``’s/``\.spad//``’”``) run(“bash”, “grep ‘)abbrev package’ *.spad”, “|sed ``’s/``. //'") run(“cat”, “divisors(6)”, “|fricas -nosman|grep '^ (1)'") run(“cat”, “factorial(20)”, "| sage -q | sed ‘s/^sage: //'")
- execute: String -> Void
execute(cmd)executes the command linecmdwithout returning anything. That is, in fact, the same as: systemCommand(“system “cmd)$MoreSystemCommands
- knownCommands: () -> List List String
knownCommands()returns a list of all program names together with their respective commandline values.
- run: (String, String, String) -> List String
run(prog,cmd,cmdline)executes “progtfncmdline” wheretfnis a temporary filename rxcXXXXX.tmpwhere XXXXX is a random number. Ifcmdis emptytfnis empty, otherwise, it writescmdto rxcXXXXX.tmp. Theprogis assumed to read the temporary file and send its output to stdout. The temporary file(s) are assumed to be created in the current directory and removed after execution.progis considered to be a key in previously stored executables hash table via setExecutable!. If the table has no such key, thenprogis taken literally as the name of a program. The run command collects stdout and returns these lines.