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

## Shell script wrapper for all R CMD commands.
## For internal use only.

R_CMD="${R_HOME}/bin/Rcmd"
export R_CMD

## Add `share/perl' to the perl library path.
if test -n "${PERL5LIB}"; then
  PERL5LIB="${R_HOME}/share/perl:${PERL5LIB}"
  export PERL5LIB
else
  PERLLIB="${R_HOME}/share/perl:${PERLLIB}"
  export PERLLIB
fi

. ${R_HOME}/etc/Renviron
export `sed 's/^ *#.*//; s/^\(.*\)=.*/\1/' ${R_HOME}/etc/Renviron`

PATH="${R_HOME}/bin:${PATH}" 
case "${1}" in
  perl)
    shift;
    exec ${PERL} "${@}"
    ;;
  awk)
    shift;
    exec ${AWK}  "${@}"
    ;;
  *)
    exec "${@}"
    ;;
esac

### Local Variables: ***
### mode: sh ***
### sh-indentation: 2 ***
### End: ***