shell_command


shell_command(cmd, @optional capture)
      

Call up the shell to execute the command cmd, which must be a string. If capture is true, return a pair consisting of the exit status of the shell in the head field, and the captured output in the tail field. Otherwise, return the exit status of the command.

Be advised that the shell that is used, and consequently the syntax of command, depends on the operating system. On Unix, the shell /bin/sh is usually invoked.

Examples:


let r = shell_command("date")
//> Tue Jun  7 10:16:02 IST 2016
r
// 0
r = shell_command("date", true)
r
// 0:Tue Jun  7 10:16:07 IST 2016
      

Also see:

command_line
getenv
exit


Core Module Index | Contents