Re: [R] system command to a specific shell (bash)
On 17.04.2012 01:26, MacQueen, Don wrote: I believe that shell() was superceded by system(), quite a long time ago. Not really, under Windows, shell() will start a shell while system() won't. Uwe Ligges However, I get this: foo- system('printenv',intern=TRUE) ; foo[grepl('SHELL',foo)] [1] SHELL=/bin/tcsh XTERM_SHELL=/bin/tcsh And tcsh is my login shell, i.e., as specified for my account at the OS level. To me, this implies that you should get bash by default if your account is configured for bash, but I can't know for certain. -Don __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] system command to a specific shell (bash)
I need to run a bash command, but when you call system() the default shell is sh (see my sessionInfo below). I found the shell command ( http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/base/html/shell.html) but it seems to be disappeared in current versions of R? I am running all this from R CMD BATCH with system calls to other R scripts. For a little more info, I'm generating sphinx documents (a python documentation library) through R and need to use a python virtual environment. So I need to call system('source bin/activate'), but source isn't a recognized command in the sh shell... Any help is appreciated, Justin sessionInfo() R version 2.15.0 (2012-03-30) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] graphics grDevices utils datasets stats grid methods base other attached packages: [1] ggplot2_0.9.0 reshape2_1.2.1 plyr_1.7.1 loaded via a namespace (and not attached): [1] colorspace_1.1-1 dichromat_1.2-4digest_0.5.1 MASS_7.3-16 memoise_0.1munsell_0.3 [7] proto_0.3-9.2 RColorBrewer_1.0-5 scales_0.2.0 stringr_0.6 tools_2.15.0 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] system command to a specific shell (bash)
You could make a hash bang bash script that sources the file and then proceeds to do whatever you want. Bourne shell should have no problems invoking another shell. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Justin Haynes jto...@gmail.com wrote: I need to run a bash command, but when you call system() the default shell is sh (see my sessionInfo below). I found the shell command ( http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/base/html/shell.html) but it seems to be disappeared in current versions of R? I am running all this from R CMD BATCH with system calls to other R scripts. For a little more info, I'm generating sphinx documents (a python documentation library) through R and need to use a python virtual environment. So I need to call system('source bin/activate'), but source isn't a recognized command in the sh shell... Any help is appreciated, Justin sessionInfo() R version 2.15.0 (2012-03-30) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] graphics grDevices utils datasets stats grid methods base other attached packages: [1] ggplot2_0.9.0 reshape2_1.2.1 plyr_1.7.1 loaded via a namespace (and not attached): [1] colorspace_1.1-1 dichromat_1.2-4digest_0.5.1 MASS_7.3-16 memoise_0.1munsell_0.3 [7] proto_0.3-9.2 RColorBrewer_1.0-5 scales_0.2.0 stringr_0.6 tools_2.15.0 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] system command to a specific shell (bash)
Thanks Jeff, but I'm running a python program that expects certain functionality that bash provides and sh doesn't... I can just stop using github checkouts and use system packages though and fix this. I'm mostly wondering where the shell command went in base R... it sounds like it completely solves this issue but doesn't exist in my R On Mon, Apr 16, 2012 at 10:58 AM, Jeff Newmiller jdnew...@dcn.davis.ca.uswrote: You could make a hash bang bash script that sources the file and then proceeds to do whatever you want. Bourne shell should have no problems invoking another shell. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Justin Haynes jto...@gmail.com wrote: I need to run a bash command, but when you call system() the default shell is sh (see my sessionInfo below). I found the shell command ( http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/base/html/shell.html ) but it seems to be disappeared in current versions of R? I am running all this from R CMD BATCH with system calls to other R scripts. For a little more info, I'm generating sphinx documents (a python documentation library) through R and need to use a python virtual environment. So I need to call system('source bin/activate'), but source isn't a recognized command in the sh shell... Any help is appreciated, Justin sessionInfo() R version 2.15.0 (2012-03-30) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] graphics grDevices utils datasets stats grid methods base other attached packages: [1] ggplot2_0.9.0 reshape2_1.2.1 plyr_1.7.1 loaded via a namespace (and not attached): [1] colorspace_1.1-1 dichromat_1.2-4digest_0.5.1 MASS_7.3-16 memoise_0.1munsell_0.3 [7] proto_0.3-9.2 RColorBrewer_1.0-5 scales_0.2.0 stringr_0.6 tools_2.15.0 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] system command to a specific shell (bash)
I believe that shell() was superceded by system(), quite a long time ago. However, I get this: foo - system('printenv',intern=TRUE) ; foo[grepl('SHELL',foo)] [1] SHELL=/bin/tcsh XTERM_SHELL=/bin/tcsh And tcsh is my login shell, i.e., as specified for my account at the OS level. To me, this implies that you should get bash by default if your account is configured for bash, but I can't know for certain. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 4/16/12 12:05 PM, Justin Haynes jto...@gmail.com wrote: Thanks Jeff, but I'm running a python program that expects certain functionality that bash provides and sh doesn't... I can just stop using github checkouts and use system packages though and fix this. I'm mostly wondering where the shell command went in base R... it sounds like it completely solves this issue but doesn't exist in my R On Mon, Apr 16, 2012 at 10:58 AM, Jeff Newmiller jdnew...@dcn.davis.ca.uswrote: You could make a hash bang bash script that sources the file and then proceeds to do whatever you want. Bourne shell should have no problems invoking another shell. - -- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k - -- Sent from my phone. Please excuse my brevity. Justin Haynes jto...@gmail.com wrote: I need to run a bash command, but when you call system() the default shell is sh (see my sessionInfo below). I found the shell command ( http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/base/html/shell.htm l ) but it seems to be disappeared in current versions of R? I am running all this from R CMD BATCH with system calls to other R scripts. For a little more info, I'm generating sphinx documents (a python documentation library) through R and need to use a python virtual environment. So I need to call system('source bin/activate'), but source isn't a recognized command in the sh shell... Any help is appreciated, Justin sessionInfo() R version 2.15.0 (2012-03-30) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] graphics grDevices utils datasets stats grid methods base other attached packages: [1] ggplot2_0.9.0 reshape2_1.2.1 plyr_1.7.1 loaded via a namespace (and not attached): [1] colorspace_1.1-1 dichromat_1.2-4digest_0.5.1 MASS_7.3-16 memoise_0.1munsell_0.3 [7] proto_0.3-9.2 RColorBrewer_1.0-5 scales_0.2.0 stringr_0.6 tools_2.15.0 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.