shell: Invoke a command in the system command-line shell

Description Usage Arguments Value Note See Also Examples

View source: R/shell.R

Description

Invoke a command in the system command-line shell

Usage

1
2
3
4
5
6
7
8
9
shell(
  command,
  args = character(),
  print = interactive(),
  wd = getwd(),
  stdoutFile = NULL,
  stderrFile = NULL,
  stderrToStdout = FALSE
)

Arguments

command

character(1). Name of program to run.

args

character. Arguments passed to command.

print

logical(1). Whether to print (echo) the commands to the console.

wd

character(1). Working directory path inside shell session.

stdoutFile, stderrFile

character(1) or NULL. File path to log stdout and/or stderr. Disabled when set NULL.

stderrToStdout

logical(1). Whether to redirect standard error (stderr) to standard output (stdout). Similar to 2>&1 in POSIX or &> in Bash.

Value

Invisible list. Contains named elements: "status", "stdout", "stderr", "timeout".

Note

Updated 2021-08-18.

See Also

Examples

1
2
3
4
5
6
x <- shell(
    command = "echo",
    args = c("hello", "world"),
    print = TRUE
)
print(x)

acidgenomics/AcidBase documentation built on Sept. 10, 2021, 1:27 a.m.