Created
January 28, 2013 13:15
-
-
Save thisirs/4655411 to your computer and use it in GitHub Desktop.
Alert user that a job finished
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
# Alert user that a job finished: | |
# lengthycmd; alert | |
# or | |
# lengthycmd | |
# <CTRL-Z> | |
# fg; alert | |
function alert() { | |
JOB=$(history 1) | |
if [[ "$JOB" == *fg\;* ]] | |
then | |
JOB=$(history 2 | head -n1) | |
fi | |
JOB=$(echo $JOB | sed -e "s/^\s*[0-9]\+\s*//" -e "s/;\s*alert$//") | |
notify-send -i terminal "Task finished" "$JOB" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment