Created
January 9, 2020 16:08
-
-
Save rrmhearts/d4068d4ca517d8384a1153f2f8452e3f to your computer and use it in GitHub Desktop.
Long bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function long { | |
START=$(date +%s.%N) | |
$* | |
EXIT_CODE=$? | |
END=$(date +%s.%N) | |
DIFF=$(echo "$END - $START" | bc) | |
RES=$(python -c "diff = $DIFF; min = int(diff / 60); print('%s min' % min)") | |
result="$1 completed in $RES, exit code $EXIT_CODE." | |
echo -e "\n⏰ $result" | |
( say -r 250 $result 2>&1 > /dev/null & ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment