Rev 31272 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#!/bin/sh# Shell wrapper for R executable.R_HOME_DIR=if test -n "${R_HOME}" && \test "${R_HOME}" != "${R_HOME_DIR}"; thenecho "WARNING: ignoring environment value of R_HOME"fiR_HOME="${R_HOME_DIR}"export R_HOME## NOTE:## We must set this here rather than in the main binary.: ${R_LD_LIBRARY_PATH=${R_HOME}/lib:@R_LD_LIBRARY_PATH@}if test -z "${@shlibpath_var@}"; then@shlibpath_var@="${R_LD_LIBRARY_PATH}"else@shlibpath_var@="${R_LD_LIBRARY_PATH}:${@shlibpath_var@}"fiexport @shlibpath_var@usage="Usage: R [options] [< infile] [> outfile]or: R CMD command [arguments]Start R, a system for statistical computation and graphics, with thespecified options, or invoke an R tool via the 'R CMD' interface.Options:-h, --help Print short help message and exit--version Print version info and exitRHOME Print path to R home directory and exit--save Do save workspace at the end of the session--no-save Don't save it--no-environ Don't read the site and user environment files--no-site-file Don't read the site-wide Rprofile--no-init-file Don't read the .Rprofile or ~/.Rprofile files--restore Do restore previously saved objects at startup--no-restore-data Don't restore previously saved objects--no-restore-history Don't restore the R history file--no-restore Don't restore anything--vanilla Combine --no-save, --no-restore, --no-site-file,--no-init-file and --no-environ--no-readline Don't use readline for command-line editing--min-vsize=N Set vector heap min to N bytes; '4M' = 4 MegaB--max-vsize=N Set vector heap max to N bytes;--min-nsize=N Set min number of cons cells to N--max-nsize=N Set max number of cons cells to N--max-ppsize=N Set max size of protect stack to N-q, --quiet Don't print startup message--silent Same as --quiet--slave Make R run as quietly as possible--verbose Print more information about progress-d, --debugger=NAME Run R through debugger NAME--debugger-args=ARGS Pass ARGS as arguments to the debugger-g, --gui=TYPE Use TYPE as GUI; possible values are 'X11'(default), 'none', 'Tk' and 'gnome'--args Skip the rest of the command lineCommands:BATCH Run R in batch modeCOMPILE Compile files for use with RSHLIB Build shared library for dynamic loadingINSTALL Install add-on packagesREMOVE Remove add-on packagesbuild Build add-on packagescheck Check add-on packagesLINK Front-end for creating executable programsRprof Post-process R profiling filesRdconv Convert Rd format to various other formatsRd2dvi Convert Rd format to DVI/PDFRd2txt Convert Rd format to pretty textSd2Rd Convert S documentation to Rd formatconfig Obtain configuration information about RPlease use 'R CMD command --help' to obtain further information aboutthe usage of 'command'.Report bugs to <r-bugs@r-project.org>."version="R REPLACE_BY_VERSION.Copyright (C) REPLACE_BY_YEAR R Development Core TeamR is free software and comes with ABSOLUTELY NO WARRANTY.You are welcome to redistribute it under the terms of the GNUGeneral Public License. For more information about these matters,see http://www.gnu.org/copyleft/gpl.html."error () {echo "ERROR: $*" >&2exit 1}### Argument loopargs=debugger=debugger_args=while test -n "${1}"; docase ${1} inRHOME|--print-home)echo "${R_HOME}"; exit 0 ;;CMD)shift;exec sh "${R_HOME}/bin/Rcmd" "${@}" ;;--gnome)error "option '${1}' is defunct, use '--gui=gnome'";;-d|--debugger)if test -n "`echo ${2} | sed 's/^-.*//'`"; thendebugger="${2}"; shiftelseerror "option '${1}' requires an argument"fi;;--debugger=*)debugger=`echo "${1}" | sed -e 's/[^=]*=//'` ;;--debugger-args=*)debugger_args=`echo "${1}" | sed -e 's/[^=]*=//'` ;;-h|--help)echo "${usage}"; exit 0 ;;--version)echo "${version}"; exit 0 ;;*)args="${args} ${1}" ;;esacshiftdone## R_HOME may have moved, so check## (or you get "GUI X11 is not supported")if test -x "${R_HOME}"; then:elseerror "R_HOME ('${R_HOME}') not found"fi## Create a per-session dir: ${TMPDIR=/tmp}{ tmp=`(umask 077 && mktemp -d -q "${TMPDIR}/RtmpXXXXXX") 2>/dev/null` \&& test -n "${tmp}" && test -d "${tmp}" ; } ||{ test -n "${RANDOM}" && tmp=${TMPDIR}/Rtmp$$-${RANDOM} \&& (umask 077 && mkdir "${tmp}") ; } ||{ tmp=${TMPDIR}/Rtmp$$ && (umask 077 && mkdir "${tmp}") ; } ||error "cannot create temporary R session directory"R_SESSION_TMPDIR="${tmp}"export R_SESSION_TMPDIR## StartupR_binary="${R_HOME}/bin/exec/R"if test -z "${debugger}"; thenexec "${R_binary}" @R_BATCHSAVE@ ${args}else## Ideally, we would like the debugger to start R with additional## ('inferior') arguments, but not all debuggers can do this. We know## about valgrind and some versions of GDB , and deal with these.## Otherwise, to be on the safe side, we disregard non-debugger## command line args.args_ok=nocase "`${debugger} --version 2>/dev/null`" in"GNU gdb"*)if ${debugger} --help 2>/dev/null | \grep ' *--args' >/dev/null; thenargs_ok=yesdebugger_args="${debugger_args} --args"fi;;valgrind*)args_ok=yes;;esacif test -n "${args}" && test "${args_ok}" = no; thenecho "*** Further command line arguments ('${args}') disregarded"echo "*** (maybe use 'run ${args}' from *inside* ${debugger})"echo ""exec ${debugger} ${debugger_args} "${R_binary}"elseexec ${debugger} ${debugger_args} "${R_binary}" ${args}fifi### Local Variables: ***### mode: sh ***### sh-indentation: 2 ***### End: ***