The R Project SVN R

Rev

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