[Rd] Why cannot `Rscript -e` accept an empty line?

Yihui Xie xie at yihui.name
Sat Mar 9 22:32:21 CET 2013


See the example below (under Ubuntu):

$ Rscript -e '1' -e '2'
[1] 1
[1] 2
$ Rscript -e '1' -e '' -e '2'
ERROR: option '-e' requires an argument
$ uname -a
Linux xie 3.5.0-25-generic #39-Ubuntu SMP Mon Feb 25 18:26:58 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux

Similar problem under Windows:

Rscript -e "1" -e "" -e "2"
[1] 1
Error: object 'e' not found
Execution halted

I can certainly save the code in a script and run Rscript foo.R, but
I'm curious why Rscript stops when the -e argument is an empty string.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



More information about the R-devel mailing list