[R] #!/usr/bin/env Rscript --vanilla ??
Martin Maechler
maechler at stat.math.ethz.ch
Fri Apr 13 10:32:13 CEST 2012
I think that's my first true question (rather than answer)
to R-help.
As R has, for a long time, become my primary scripting and
programming language, I'm prefering at times to write Rscript
files instead of shell scripts, notably when R has nice ways to
do some of the things.
On a standard standalone platform with standard R,
I would start such a script with
---------------------------------------
#! /usr/bin/Rscript --vanilla
---------------------------------------
(yes, the "--vanilla" is important to me, in this case)
However; as, at work, my scripts have to work correctly on quite a
few different (unixy : several flavors of Linux, Solaris, MacOS X) platforms,
*and* as an R developer, I have many different versions of R
installed simultaneously, using /usr/bin/Rscript is not an
option.
Rather, I'd use the /usr/bin/env trick :
---------------------------------------
#! /usr/bin/env Rscript
---------------------------------------
which finds Rscript in "the correct" place, according to the
current PATH. All fine till now.
PROBLEM: It does not work with '--vanilla' or any other argument:
If I start my script with
#! /usr/bin/env Rscript --vanilla
the error message simply is
/usr/bin/env: Rscript --vanilla: No such file or directory
I have tried a few variations on the theme, using quotes in
different places, but have not succeeded till now.
Any suggestions?
Martin Maechler, ETH Zurich
More information about the R-help
mailing list