【发布时间】:2017-03-06 18:09:36
【问题描述】:
有没有办法将 shell 环境变量传递给 Rscript。例如:
Rscript -e 'devtools::install_github("private/repo",auth_token = "$GITHUB_CRED")'
我已经尝试过了,它只是传递了文字字符。我想知道是否还有其他方法?
【问题讨论】:
-
可能是
auth_token = shell("$GITHUB_CRED", intern = TRUE)? -
我要试一试。我现在有一个 hacky 解决方案,我将它推送到一个文件,然后
readLines() -
args 怎么样?
Rscript -e 'args <- commandArgs(trailingOnly = TRUE); paste("bla", args[1])' myPassword -
@RichScriven 我尝试了
shell和system,都没有成功。 -
@zx8754 现在也将尝试您的解决方案。
标签: r