Run complex native scripts with a single command, similar to system commands.
## Overview The purpose of the scriptexec package is to enable quick and easy way to execute native scripts.
## Usage Simply load the library and invoke the execute
output <- scriptexec::execute("echo Current Directory:\ndir")
cat(sprintf("Exit Status: %s Output: %s\n", output$status, output$output))
# execute multiple commands as a script
output <- scriptexec::execute(c("cd", "echo User Home:", "dir"))
cat(sprintf("Exit Status: %s Output: %s\n", output$status, output$output))
# pass arguments to the script, later defined as ARG1, ARG2, ...
# and also pass some env vars
output <- execute("echo $ARG1 $ARG2 $MYENV", args = c("TEST1", "TEST2"), env = c("MYENV=TEST3"))
cat(sprintf("%s\n", output))
# non zero status code is returned in case of errors
output <- scriptexec::execute("exit 1")
cat(sprintf("Status: %s\n", output$status))
cat(sprintf("%s\n", output))
# do not wait for command to finish
execute('echo my really long task', wait = FALSE)
## Installation Install latest release from github (recommanded):
devtools::install_github("sagiegurari/scriptexec@0.2.1")
Install from CRAN (might be older, depending on CRAN team approval process)
install.packages("scriptexec")
Install current development version from github (might be unstable):
devtools::install_github("sagiegurari/scriptexec")
See full docs at: API Docs
See NEWS
## License Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.