Created
February 7, 2011 21:54
-
-
Save andy722/815316 to your computer and use it in GitHub Desktop.
Runs command in background and shows notification window on completion
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
#!/bin/bash | |
_run() { | |
wd=$PWD | |
bash -cli "$*" | |
result=$? | |
[ $result == 0 ] && description="Successfully executed" || description="Failed with code $result" | |
cmd=${*:-"Nothing"} | |
file=`mktemp` | |
trap "rm $file" EXIT ERR TERM KILL | |
echo -e "$description:\n" > $file | |
echo "Command: $cmd" >>$file | |
echo -n "Directory: $wd" >> $file | |
LANG=C xmessage -default okay -file $file | |
rm $file | |
return $result | |
} | |
_run $* & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment