#!/usr/bin/env bash # fate - runs the command speicifed and # notifies the user of the status # once execution is complete # through libnotify. # Author: Seth Rees, www.sthrs.me # Based on a tiny script by Ctrl-C # http://ctrl-c.us/blog/archives/746 # Run the command specified. eval $@ if [ $? -eq 0 ] then # If the exit status is 0, it most likely executed with no errors. ARGS='-u normal -i appointment-soon' STATUS='completed' else # If its not 0, then it probably did have an error. ARGS='-u critical -i appointment-missed' STATUS='not completed' EXIT=" (returned error code $?)" fi # Send the notice one execution is completed. eval "notify-send $ARGS -t 10000 \"Fate\" \"The command '$@' was $STATUS successfully$EXIT.\""