ソースを参照

Make runall script compatible with macos with gnu-time installed

Taddeus Kroes 3 年 前
コミット
c6acf2750e
1 ファイル変更2 行追加1 行削除
  1. 2 1
      runall.sh

+ 2 - 1
runall.sh

@@ -1,12 +1,13 @@
 #!/usr/bin/env bash
 python=${PYTHON:-python3}
 trap exit SIGINT
+time=`which gtime` || time=`which time`
 for year in "$@"; do
     day=1
     for solution in $year/[012]*.py; do
         echo "-- year $year -- day $day -------------------------------"
         [ -e $year/input/$day ] && inp=$year/input/$day || inp=/dev/null
-        `which time` -f 'elapsed: %E' "$python" $solution < $inp
+        $time -f 'elapsed: %E' "$python" $solution < $inp
         echo
         day=$((day + 1))
     done