如何在R中使用system()或shell()执行git-bash命令 [英] How to execute git-bash command with system() or shell() in R
问题描述
我想通过R中的 system()
或 shell()
函数在 git-bash
shell中运行一些命令.我是在Windows上,默认外壳是命令提示符.有什么办法可以将 system()
中的shell切换为 git-bash
?
谢谢
如果您的%PATH%
包含 C:\ Program Files(x86)\ Git \ bin \
,您应该可以进行系统调用:
bash --login -i -c您的命令"
OP JdeMello 确认 对我有用. I would like to run some command in Thank you If your The OP JdeMello confirms in the comments: Yup: Didn't have For completion, we can add That worked for me.
这篇关于如何在R中使用system()或shell()执行git-bash命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!git-bash
shell via system()
or shell()
functions in R. I am on windows and the default shell is the command prompt. Is there any way I can switch the shell in system()
to git-bash
?%PATH%
includes C:\Program Files (x86)\Git\bin\
, you should be able to system call:bash --login -i -c "your command"
C:\Program Files\Git\bin
in PATH
. Git\bin
to PATH in R
(if necessary): if(length(grep("(?i)Git//bin", Sys.getenv("PATH"))) == 0)
Sys.setenv(PATH=paste0(Sys.getenv("PATH"),";C://Program Files//Git//bin"))