[R] --no-save and --save toggle from inside R? + BATCH stderr

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jul 11 16:41:03 CEST 2006


This sort of thing is contrary to the Unix spirit.  It gives the user no 
choice but to be told that there is a non-zero error code, whereas it is 
really easy for the user to wrap the command in his/her own script that 
reports the error code in whatever form is desired.

The Unix idea is to think about combining things from your toolkit, not
complicate the tools with endless options (and this would have to be made 
optional as I for one don't want it).

Assuming you are concerned with user errors and not those deep in R, you 
can use R's own error-handling system to set the error status anyway, and 
report as wanted.


On Tue, 11 Jul 2006, Duncan Murdoch wrote:

> ivo welch wrote:
> > the following diff to the shell script invoking R prints an error
> > message if R terminates with an error code:
> >
> > 112c112,119
> > <       exec sh "${R_HOME}/bin/Rcmd" "${@}" ;;
> > ---
> >   
> >>       sh "${R_HOME}/bin/Rcmd" "${@}"
> >>       rc="$?"
> >>       if [ "$rc" -ne 0 ]; then
> >>          shift ;
> >>          echo "${@}: Error Return Code: $rc"
> >>       fi
> >>       exit $?
> >>       ;;
> >>     
> This looks to me like a good suggestion, but I generally don't make 
> modifications to platform-specific things on platforms I don't use, so 
> I'd suggest posting this to R-devel or on the bug list as a wishlist 
> item.  Otherwise it might get lost.
> 
> 
> Duncan Murdoch
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list