Created
October 29, 2017 16:38
-
-
Save rcassani/2fc5224e9be08aec8f220647e7ad12c2 to your computer and use it in GitHub Desktop.
Notify and run a command
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 | |
# Usage | |
if [ ${#@} == 0 ] | |
then | |
echo "Usage: $0 notification_msg [command] [icon-path]" | |
echo "* notification: <Mensage for notification>" | |
echo "* [command] : <Command to execute>" | |
echo "* [icon-path] : <Path to icon path, Default Star icon>" | |
fi | |
# Default icon is a Star | |
if [ -z $3 ] | |
then | |
iconpath="/usr/share/icons/gnome/32x32/status/starred.png" | |
else | |
iconpath=$3 | |
fi | |
# Message to display, minimum expire time | |
if [ -n "$1" ] | |
then | |
notify-send "$1" --expire-time=1 --urgency=normal --icon=$iconpath | |
fi | |
# Execute the command | |
eval $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment