Notification Utility¶
Get a utility to notify you when a command completes...
Setup¶
Put the following into your ~/.bashrc
:
function run_prompt() {
if [ ! -z ${NOTIFY_UTILITY:+x} ]; then
"${NOTIFY_UTILITY}" "${1:-?}"
fi
}
export PROMPT_COMMAND='run_prompt "$?"'
Usage¶
When you want to be notified that a command has completed, just set the NOTIFY_UTILITY
variable:
NOTIFY_UTILITY='~/.bin/notify-desk'
The ~/.bin/notify-desk
file must be executable, and can take any action you want! It's first parameter is the return code of the previous command (or a question mark - ?
).