I would like to run some command in 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
?
Thank you
If your %PATH%
includes C:\Program Files (x86)\Git\bin\
, you should be able to system call:
bash --login -i -c "your command"
The OP JdeMello confirms in the comments:
Yup: Didn't have
C:\Program Files\Git\bin
inPATH
.For completion, we can add
Git\bin
to PATH inR
(if necessary):if(length(grep("(?i)Git//bin", Sys.getenv("PATH"))) == 0) Sys.setenv(PATH=paste0(Sys.getenv("PATH"),";C://Program Files//Git//bin"))
That worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With