The R Project SVN R

Rev

Rev 47821 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2195 hornik 1
#
4580 hornik 2
# ${R_HOME}/bin/BATCH
2195 hornik 3
 
37351 ripley 4
revision='$Rev: 49275 $'
7357 hornik 5
version=`set - ${revision}; echo ${2}`
47522 ripley 6
version="R batch front end: ${R_VERSION} (r${version})
7217 hornik 7
 
37649 hornik 8
Copyright (C) 2000--2006 The R Core Development Team.
42192 ripley 9
This is free software; see the GNU General Public License version 2
11515 hornik 10
or later for copying conditions.  There is NO warranty."
2195 hornik 11
 
31478 ripley 12
opts="--restore --save --no-readline"
27143 ripley 13
 
11515 hornik 14
usage="Usage: R CMD BATCH [options] infile [outfile]
15
 
7357 hornik 16
Run R non-interactively with input from infile and place output (stdout
17
and stderr) to another file.  If not given, the name of the output file
20002 hornik 18
is the one of the input file, with a possible '.R' extension stripped,
19
and '.Rout' appended.
7357 hornik 20
 
21
Options:
22
  -h, --help		print short help message and exit
23
  -v, --version		print version info and exit
47821 ripley 24
  --no-timing           do not report the timings
7357 hornik 25
  --			end processing of options
26
 
20002 hornik 27
Further arguments starting with a '-' are considered as options as long
28
as '--' was not encountered, and are passed on to the R process, which
27143 ripley 29
by default is started with '$opts'.
41036 ripley 30
See also help('BATCH') inside R.
7357 hornik 31
 
10633 hornik 32
Report bugs to <r-bugs@r-project.org>."
7357 hornik 33
 
2195 hornik 34
while test -n "${1}"; do
7217 hornik 35
  case ${1} in
7357 hornik 36
    -h|--help)
37
      echo "${usage}"; exit 0 ;;
38
    -v|--version)
39
      echo "${version}"; exit 0 ;;
47821 ripley 40
    --no-timing)
41
      timing=no; shift ;;
7217 hornik 42
    --) shift; break ;;
49275 ripley 43
    -d|-g) opts="${opts} ${1} ${2}"; shift; shift ;;
7357 hornik 44
    -*) opts="${opts} ${1}"; shift ;;
7217 hornik 45
    *)  break ;;
46
  esac
2195 hornik 47
done
48
 
7357 hornik 49
in=${1}
50
out=${2-`basename ${1} .R`.Rout}
2195 hornik 51
 
47821 ripley 52
if test -z "${timing}"; then
53
  R_BATCH=${$}
54
  export R_BATCH
55
fi
40416 ripley 56
## this used to set options(echo=TRUE), but that is the default
57
## except for --slave, and why inhibit the latter?
7218 hornik 58
 
40417 ripley 59
## need to put -f first in case user does --args
40621 ripley 60
${R_HOME}/bin/R -f ${in} ${opts} ${R_BATCH_OPTIONS} >${out} 2>&1
40417 ripley 61
 
7218 hornik 62
### Local Variables: ***
63
### mode: sh ***
64
### sh-indentation: 2 ***
65
### End: ***