Hi,

I am working on a GRASS script (bash script), which should run a R script.
I am working on Ubuntu 12.10, with R 2.15.3 and GRASS GIS 7.0 (I am not
sure the latter isn't really relevant as the grass script is just a bash
script). The R script is evoked with a call to Rscript ($RGRASSSCRIPT is a
shell variable with the file name of the R script, the rest are variables I
want to read into R) :

Rscript --no-save --no-restore $RGRASSSCRIPT $GIS_OPT_INMAP $GIS_OPT_PRES
$GIS_OPT_ENV $GIS_OPT_OUTMAP_GLM $GIS_OPT_FSTATS $GIS_FLAG_M $GIS_OPT_SPP
$GIS_OPT_SPA $GIS_OPT_FAM $GIS_OPT_TERMS $GIS_FLAG_Q $GIS_OPT_OUTMAP_PROJ
$GIS_OPT_ENV_PROJ $GIS_OPT_KFOLD $GIS_OPT_SFOLD

In the R script, I use the commandArgs function to capture the arguments
supplied to Rscript:

args <- commandArgs(trailingOnly=TRUE)

The problem is that args only contains the first 12 arguments (up to and
including $GIS_OPT_OUTPUT_PROJ).

I also tried using a call to R instead of Rscript:

R --no-save --no-restore --no-site-file --no-init-file --args
"${GIS_OPT_INMAP}" "${GIS_OPT_PRES}" "${GIS_OPT_ENV}"
"${GIS_OPT_OUTMAP_GLM}" "${GIS_OPT_FSTATS}" "${GIS_FLAG_M}"
"${GIS_OPT_SPP}" "${GIS_OPT_SPA}" "${GIS_OPT_FAM}" "${GIS_OPT_TERMS}"
"${GIS_FLAG_Q}" "${GIS_OPT_OUTMAP_PROJ}" "${GIS_OPT_ENV_PROJ}"
"${GIS_OPT_KFOLD}" "${GIS_OPT_SFOLD}" < "$RGRASSSCRIPT" >> "$LOGFILE" 2>&1

This gives me all the 15 arguments when using commandArgs (The reason I am
not using that option is because evoking the script that way gives me
another problem with R jumping back to the top at a seemingly random place
somewhere halfway the script and start to run the first lines code again -
but that is probably better left for another email).

So, my question is, I guess, are there limits on the number of arguments
that can be supplied to Rscript? Or, perhaps more likely, am I doing
something wrong?

Best wishes,

Paulo

	[[alternative HTML version deleted]]

