| 0 | 1 #!/bin/sh | 
|  | 2 | 
|  | 3 | 
|  | 4 #Copied from https://github.com/galaxyproject/galaxy/blob/dev/tools/stats/r_wrapper.sh | 
|  | 5 | 
|  | 6 ### Run R providing the R script in $1 as standard input and passing | 
|  | 7 ### the remaining arguments on the command line | 
|  | 8 | 
|  | 9 # Function that writes a message to stderr and exits | 
|  | 10 fail() | 
|  | 11 { | 
|  | 12     echo "$@" >&2 | 
|  | 13     exit 1 | 
|  | 14 } | 
|  | 15 | 
|  | 16 # Ensure R executable is found | 
|  | 17 which R > /dev/null || fail "'R' is required by this tool but was not found on path" | 
|  | 18 | 
|  | 19 # Extract first argument | 
|  | 20 rfile=$1 | 
|  | 21 package_file=$2 | 
|  | 22 version_file=$3 | 
|  | 23 | 
|  | 24 # Ensure the file exists | 
|  | 25 test -f $infile || fail "R input file '$infile' does not exist" | 
|  | 26 | 
|  | 27 # Invoke R passing file named by first argument to stdin | 
|  | 28 #Remove --slave for full R output | 
|  | 29 R --vanilla --slave --args $package_file < $rfile | 
|  | 30 echo "done" |