#!/bin/sh if [[ "$1" == '-e' ]] then shift else PREFIX=exec fi $PREFIX R CMD BATCH "$@" vi $(ls -c *.Rout | head -1)