The R Project SVN R

Rev

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

Rev Author Line No. Line
2195 hornik 1
#!/bin/sh
2
#
4580 hornik 3
# ${R_HOME}/bin/BATCH
2195 hornik 4
 
11515 hornik 5
revision='$Revision: 1.11 $'
7357 hornik 6
version=`set - ${revision}; echo ${2}`
11515 hornik 7
version="R batch front end ${version}
7217 hornik 8
 
11515 hornik 9
Copyright (C) 2000 The R Core Development Team.
10
This is free software; see the GNU General Public Licence version 2
11
or later for copying conditions.  There is NO warranty."
2195 hornik 12
 
11515 hornik 13
usage="Usage: R CMD BATCH [options] infile [outfile]
14
 
7357 hornik 15
Run R non-interactively with input from infile and place output (stdout
16
and stderr) to another file.  If not given, the name of the output file
17
is the one of the input file, with a possible \`.R' extension stripped,
18
and \`.Rout' appended.
19
 
20
Options:
21
  -h, --help		print short help message and exit
22
  -v, --version		print version info and exit
23
  --			end processing of options
24
 
25
Further arguments starting with a \`-' are considered as options as long
26
as \`--' was not encountered, and are passed on to the R process, which
27
by default is started with \`--restore --save --no-readline'.
28
 
10633 hornik 29
Report bugs to <r-bugs@r-project.org>."
7357 hornik 30
 
8783 ripley 31
opts="--restore --save --no-readline --gui=none"
7357 hornik 32
 
2195 hornik 33
while test -n "${1}"; do
7217 hornik 34
  case ${1} in
7357 hornik 35
    -h|--help)
36
      echo "${usage}"; exit 0 ;;
37
    -v|--version)
38
      echo "${version}"; exit 0 ;;
11197 ripley 39
    --min-vsize|--min-nsize|--max-vsize|--max-nsize|--vsize|--nsize)
7357 hornik 40
      # Deprecated ...
41
      opts="${opts} ${1}=${2}"; shift 2 ;;
7217 hornik 42
    --) shift; break ;;
7357 hornik 43
    -*) opts="${opts} ${1}"; shift ;;
7217 hornik 44
    *)  break ;;
45
  esac
2195 hornik 46
done
47
 
7357 hornik 48
in=${1}
49
out=${2-`basename ${1} .R`.Rout}
2195 hornik 50
 
2510 maechler 51
(echo "invisible(options(echo = TRUE))"
7357 hornik 52
  cat ${in}
53
  echo "proc.time()"
54
) | ${R_HOME}/bin/R ${opts} >${out} 2>&1
7218 hornik 55
 
56
### Local Variables: ***
57
### mode: sh ***
58
### sh-indentation: 2 ***
59
### End: ***