24 January 2014

cr

slightly more complex friendly command-line tester. put in ~/bin, then PATH=~/bin:$PATH.

(Using this a lot right now because I'm at a programming camp on a guest account of an Ubuntu box that reboots afresh every day)

[[vim stash]]
#!/bin/bash
if [[ $# < 1 ]]; then
    echo "cr: args pl0x" >&2
    exit 1
fi
if g++ $1.cpp -O2 -Wall -o $1; then
    echo "cr: compile OK" >&2
    if [[ $# > 1 ]]; then
        ./$1 < $1-$2.in
    else
        ./$1 < /dev/stdin
    fi
fi