Files
usaco/lib/cmd/run.sh
T

13 lines
378 B
Bash

# usaco run <name>
[[ $# -ge 1 ]] || usage
dir="$(find_problem "$1")"
build_problem "$dir"
# run from inside the dir so freopen finds the .in file
(cd "$dir" && ./main)
# show the .out file if the program wrote one
out="$(ls "$dir"/*.out 2>/dev/null | grep -v '/a\.out$' | head -1 || true)"
if [[ -n "$out" ]]; then
echo "── $(basename "$out") ──"
cat "$out"
fi