Invoke a command in the system command-line shell
Arguments
- command
character(1)
. Name of program to run.- args
character
. Arguments passed tocommand
.- env
character
orNULL
. Environment variables of the child process. IfNULL
, the parent environment is inherited. To append new environment variables to the ones set in the current process, specify"current"
in env, without a name, and the appended ones with names. The appended ones can overwrite the current ones.- wd
character(1)
. Working directory path inside process.logical(1)
. Whether to print (echo) the commands to the console.- stdoutFile, stderrFile
character(1)
orNULL
. File path to log stdout and/or stderr. Disabled when setNULL
.- stderrToStdout
logical(1)
. Whether to redirect standard error (stderr) to standard output (stdout). Similar to2>&1
in POSIX or&>
in Bash.- returnStdout
logical(1)
. Whether to return stdout as a character vector, split by"\n"
.
See also
base::system2()
, our previously used legacy approach.