#!/bin/sh
FILE=$(basename "$1")
EXT="${FILE##*.}"
CODE="${FILE%.*}"

SUFFIX=""
case "$EXT" in
    "rb" )
        BIN="ruby"
        ;;
    "py" )
        BIN="python"
        ;;
    "cpp" )
        BIN="g++"
        SUFFIX="&& ./a.out"
        ;;
esac

# Now lets run the code
`cat $CODE.IN | $BIN $FILE $SUFFIX > $CODE.OUT`
diff $CODE.OUT $CODE.OUT
