The R Project SVN R

Rev

Rev 4580 | Rev 7218 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#!/bin/sh
#
# ${R_HOME}/bin/BATCH

REVISION='$Revision: 1.5 $'
VERSION=`set - ${REVISION}; echo ${2}`
USAGE_MSG="Usage: R BATCH [options] infile [outfile]"

OPTS="--restore --save --no-readline"

while test -n "${1}"; do
  case ${1} in
    -h|--help|-\?)
      echo "${USAGE_MSG}"; exit 0 ;;
    -V|--version)
      echo "${VERSION}"; exit 0 ;;
    --) shift; break ;;
    --vsize|--nsize|-v|-n)
      OPTS="${OPTS} ${1} ${2}"; shift 2 ;;
    -*) OPTS="${OPTS} ${1}"; shift ;;
    *)  break ;;
  esac
done

IN=${1}
OUT=${2-`basename ${1} .R`.Rout}

(echo "invisible(options(echo = TRUE))"
 cat ${IN}
 echo "proc.time()"
) | ${R_HOME}/bin/R ${OPTS} >${OUT} 2>&1