Rev 80195 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#!@R_SHELL@# Shell wrapper for R executable.R_HOME_DIR=if test "${R_HOME_DIR}" = "@prefix@/@LIBnn@/R"; thencase "@R_OS@" inlinux*)run_arch=`uname -m`case "$run_arch" inx86_64|mips64|ppc64|powerpc64|sparc64|s390x)libnn=lib64libnn_fallback=lib;;*)libnn=liblibnn_fallback=lib64;;esacif [ -x "@prefix@/${libnn}/R/bin/exec/R" ]; thenR_HOME_DIR="@prefix@/${libnn}/R"elif [ -x "@prefix@/${libnn_fallback}/R/bin/exec/R" ]; thenR_HOME_DIR="@prefix@/${libnn_fallback}/R"## else -- leave alone (might be a sub-arch)fi;;esacfiif 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_HOMER_SHARE_DIR="${R_HOME_DIR}/share"export R_SHARE_DIRR_INCLUDE_DIR="${R_HOME_DIR}/include"export R_INCLUDE_DIRR_DOC_DIR="${R_HOME_DIR}/doc"export R_DOC_DIR# Since this script can be called recursively, we allow R_ARCH to# be overridden from the environment.# This script is shared by parallel installs, so nothing in it should# depend on the sub-architecture except the default here.: ${R_ARCH=@R_ARCH@}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 exit--encoding=ENC Specify encoding to be used for stdin--encoding ENCRHOME 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 user R profile--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--max-ppsize=N Set max size of protect stack to N--min-nsize=N Set min number of fixed size obj's (\"cons cells\") to N--min-vsize=N Set vector heap minimum to N bytes; '4M' = 4 MegaB-q, --quiet Don't print startup message--silent Same as --quiet-s, --no-echo Make R run as quietly as possible--interactive Force an interactive session--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 TYPE, --gui=TYPE Use TYPE as GUI; possible values are 'X11' (default)and 'Tk'.--arch=NAME Specify a sub-architecture--args Skip the rest of the command line-f FILE, --file=FILE Take input from 'FILE'-e EXPR Execute 'EXPR' and exitFILE may contain spaces but not shell metacharacters.Commands: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 formatsRd2pdf Convert Rd format to PDFRd2txt Convert Rd format to pretty textStangle Extract S/R code from Sweave documentationSweave Process Sweave documentationRdiff Diff R output ignoring headers etcconfig Obtain configuration information about Rjavareconf Update the Java configuration variablesrtags Create Emacs-style tag files from C, R, and Rd filesPlease use 'R CMD command --help' to obtain further information aboutthe usage of 'command'.Options --arch, --no-environ, --no-init-file, --no-site-file and --vanillacan be placed between R and CMD, to apply to R processes run by 'command'Report bugs at <https://bugs.R-project.org>."## some systems have a more portable sed, e.g. /usr/xpg4/bin/sed on Solaris,## so make sure that is used.SED=@SED@export SEDerror () {echo "ERROR: $*" >&2exit 1}### Argument loopargs=debugger=debugger_args=gui=while test -n "${1}"; docase ${1} inRHOME|--print-home)echo "${R_HOME}"; exit 0 ;;CMD)shift;export R_ARCH. "${R_HOME}/etc${R_ARCH}/ldpaths"exec sh "${R_HOME}/bin/Rcmd" "${@}" ;;-g|--gui)if test -n "`echo ${2} | ${SED} 's/^-.*//'`"; thengui="${2}"args="${args} ${1} ${2}"shiftelseerror "option '${1}' requires an argument"fi;;--gui=*)gui=`echo "${1}" | ${SED} -e 's/[^=]*=//'`args="${args} ${1}";;-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 ;;--args)break ;;--arch)if test -n "`echo ${2} | ${SED} 's/^-.*//'`"; thenR_ARCH="/${2}"shiftelseerror "option '${1}' requires an argument"fi## check sub-architecture here for a better error messageif ! test -d ${R_HOME}/etc${R_ARCH}; thenerror "sub-architecture '${1}' is not installed"fi;;--arch=*)r_arch=`echo "${1}" | ${SED} -e 's/[^=]*=//'`R_ARCH="/${r_arch}"## check sub-architecture here for a better error messageif ! test -d ${R_HOME}/etc${R_ARCH}; thenerror "sub-architecture '${r_arch}' is not installed"fi;;-e)TAB=`printf "\t"`if test -n "`echo ${2} | ${SED} 's/^-.*//'`"; thena=`(echo "${2}" && echo) | ${SED} -e 's/ /~+~/g' | \${SED} -e :a -e N -e '$!ba' -e 's/\n/~n~/g' -e 's/~n~$//g' -e "s/$TAB/~t~/g"`shiftelseerror "option '${1}' requires a non-empty argument"fiargs="${args} -e $a";;-f)if test -n "`echo ${2} | ${SED} 's/^-.*//'`"; thena=`echo "${2}" | ${SED} -e 's/ /~+~/g'`; shiftelseerror "option '${1}' requires a filename argument"fiargs="${args} -f $a";;--file=*)a=`echo "${1}" | ${SED} -e 's/[^=]*=//' | ${SED} -e 's/ /~+~/g'`args="${args} --file=$a";;--no-environ)R_ENVIRON=''export R_ENVIRONR_ENVIRON_USER=''export R_ENVIRON_USERargs="${args} ${1}";;--no-site-file)R_PROFILE=''export R_PROFILEargs="${args} ${1}";;--no-init-file)R_PROFILE_USER=''export R_PROFILE_USERargs="${args} ${1}";;--vanilla)R_ENVIRON=''export R_ENVIRONR_ENVIRON_USER=''export R_ENVIRON_USERR_PROFILE=''export R_PROFILER_PROFILE_USER=''export R_PROFILE_USERargs="${args} ${1}";;*)args="${args} ${1}" ;;esacshiftdone. "${R_HOME}/etc${R_ARCH}/ldpaths"R_binary="${R_HOME}/bin/exec${R_ARCH}/R"export R_ARCHcase "${gui}" inTk|tk|X11|x11);;"");;*)error "unknown GUI ${gui}"esac## R_HOME may have moved, so checkif test -x "${R_HOME}"; then:elseerror "R_HOME ('${R_HOME}') not found"fi## Startupif 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; thenargs=`expr "${args} ${*}" : " *\(.*\)"`echo "*** 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: ***