The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
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
library(scriptexec)
# execute script text
<- scriptexec::execute("echo command1\necho command2")
output expect_equal(output$status, 0)
expect_equal(grepl("command1", output$output), TRUE)
expect_equal(grepl("command2", output$output), TRUE)
if (.Platform$OS.type == "windows") {
<- "dir"
ls_command else {
} <- "ls"
ls_command
}<- scriptexec::execute(c("echo user home:", ls_command))
output expect_equal(output$status, 0)
# execute multiple commands as a script
<- scriptexec::execute(c("cd", "echo test"))
output expect_equal(output$status, 0)
# pass arguments (later defined as ARG1, ARG2, ...) and env vars
if (.Platform$OS.type == "windows") {
<- "echo %ARG1% %ARG2% %MYENV%"
command else {
} <- "echo $ARG1 $ARG2 $MYENV"
command
}<- scriptexec::execute(command, args = c("TEST1", "TEST2"), env = c("MYENV=TEST3"))
output expect_equal(output$status, 0)
expect_equal(grepl("TEST1 TEST2 TEST3", output$output), TRUE)
# non zero status code is returned in case of errors
expect_warning(output <- scriptexec::execute("exit 1"))
expect_equal(output$status, 1)
# do not wait for command to finish
<- scriptexec::execute("echo my really long task", wait = FALSE)
output expect_equal(output$status, -1)
## Installation Install from CRAN:
install.packages("scriptexec")
Install latest release from github:
::install_github("sagiegurari/scriptexec@0.3.1") devtools
Install current development version from github (might be unstable):
::install_github("sagiegurari/scriptexec") devtools
See full docs at: API Docs
See NEWS
## License Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.