The R Project SVN R

Rev

Rev 47538 | Rev 58676 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 47538 Rev 47821
Line 1... Line 1...
1
#
1
#
2
# ${R_HOME}/bin/BATCH
2
# ${R_HOME}/bin/BATCH
3
 
3
 
4
revision='$Rev: 47538 $'
4
revision='$Rev: 47821 $'
5
version=`set - ${revision}; echo ${2}`
5
version=`set - ${revision}; echo ${2}`
6
version="R batch front end: ${R_VERSION} (r${version})
6
version="R batch front end: ${R_VERSION} (r${version})
7
 
7
 
8
Copyright (C) 2000--2006 The R Core Development Team.
8
Copyright (C) 2000--2006 The R Core Development Team.
9
This is free software; see the GNU General Public License version 2
9
This is free software; see the GNU General Public License version 2
Line 19... Line 19...
19
and '.Rout' appended.
19
and '.Rout' appended.
20
 
20
 
21
Options:
21
Options:
22
  -h, --help		print short help message and exit
22
  -h, --help		print short help message and exit
23
  -v, --version		print version info and exit
23
  -v, --version		print version info and exit
-
 
24
  --no-timing           do not report the timings
24
  --			end processing of options
25
  --			end processing of options
25
 
26
 
26
Further arguments starting with a '-' are considered as options as long
27
Further arguments starting with a '-' are considered as options as long
27
as '--' was not encountered, and are passed on to the R process, which
28
as '--' was not encountered, and are passed on to the R process, which
28
by default is started with '$opts'.
29
by default is started with '$opts'.
Line 34... Line 35...
34
  case ${1} in
35
  case ${1} in
35
    -h|--help)
36
    -h|--help)
36
      echo "${usage}"; exit 0 ;;
37
      echo "${usage}"; exit 0 ;;
37
    -v|--version)
38
    -v|--version)
38
      echo "${version}"; exit 0 ;;
39
      echo "${version}"; exit 0 ;;
-
 
40
    --no-timing)
-
 
41
      timing=no; shift ;;
39
    --) shift; break ;;
42
    --) shift; break ;;
40
    -*) opts="${opts} ${1}"; shift ;;
43
    -*) opts="${opts} ${1}"; shift ;;
41
    *)  break ;;
44
    *)  break ;;
42
  esac
45
  esac
43
done
46
done
44
 
47
 
45
in=${1}
48
in=${1}
46
out=${2-`basename ${1} .R`.Rout}
49
out=${2-`basename ${1} .R`.Rout}
47
 
50
 
-
 
51
if test -z "${timing}"; then
48
R_BATCH=${$}
52
  R_BATCH=${$}
49
export R_BATCH
53
  export R_BATCH
-
 
54
fi
50
## this used to set options(echo=TRUE), but that is the default
55
## this used to set options(echo=TRUE), but that is the default
51
## except for --slave, and why inhibit the latter?
56
## except for --slave, and why inhibit the latter?
52
 
57
 
53
## need to put -f first in case user does --args
58
## need to put -f first in case user does --args
54
${R_HOME}/bin/R -f ${in} ${opts} ${R_BATCH_OPTIONS} >${out} 2>&1
59
${R_HOME}/bin/R -f ${in} ${opts} ${R_BATCH_OPTIONS} >${out} 2>&1