Last active
August 16, 2016 07:45
-
-
Save yuki-takeichi/1c50c7e510c15f834e798013b9312107 to your computer and use it in GitHub Desktop.
Notify elapsed seconds when command is finished
This file contains hidden or 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
#!/bin/bash | |
# Notify elapsed seconds when command is finished | |
# (Mac OS X only) | |
# How to setup: | |
# 1. `brew install terminal-notifier` | |
# 2. Put this file in your /bin dir | |
# How to use: | |
# `notify sleep 2` | |
# | |
# ( See what happens after 2 seconds ;) ) | |
START=$(date +%s) | |
$@ | |
RET=$? | |
END=$(date +%s) | |
ELAPSED=$(($END - $START)) | |
if [ $? -eq 0 ]; then | |
terminal-notifier -title '🎉' -message "$ELAPSED sec" | |
else | |
terminal-notifier -title '❌' -message "$ELAPSED sec" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FIXME: