aoc

My solutions for the Advent of Code
git clone https://git.tronto.net/aoc
Download | Log | Files | Refs | README

run.sh (305B)


      1 #!/bin/sh
      2 
      3 usage() {
      4 	echo "Usage: $0 day part"
      5 	echo "Example: $0 07 b"
      6 }
      7 
      8 [ -n "$1" ] && [ -n "$2" ] || (usage; exit 1)
      9 [ -d "$1" ]  || (echo "Directory $1 does not exist"; exit 1)
     10 [ -f "$1/$2.rs" ] || (echo "File $1/$2.rs does not exist"; exit 2)
     11 
     12 rustc "$1/$2.rs" -o "$1/$2.out" && time "./$1/$2.out"