diff options
Diffstat (limited to '2022/run.sh')
| -rwxr-xr-x | 2022/run.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/2022/run.sh b/2022/run.sh new file mode 100755 index 0000000..56e1177 --- /dev/null +++ b/2022/run.sh | |||
| @@ -0,0 +1,12 @@ | |||
| 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" | ||
