1

Let's use sudo apt-get install linux as an example.

Here is the notify send command: notify-send -i terminal Bash "execution complete"

How could I substitute 'bash' with the entire sudo command? Where the command appears in bold as the title as "execution complete" displays below it as a message. This would be used as a means of notification. Once a command finishes, a notification appears displaying the message.

Others have used ";alert" to utilize notify-send. notify-send -i terminal Bash "execution complete" is saved as an alias as 'alert,' I'd like to add to this alias for the sake of convenience.

Pablo Bianchi
  • 15,657
atlaspaine
  • 63
  • 1
  • 2
  • 6
  • UPDATE: I've used the following two alias to do what was posted however it requires that I add ";alert" after every command. However I am in search of a method to avoid this. These two lines were written by another person. They've been manipulated to suit by needs.

    alias alert_helper='history|tail -n1|sed -e "s/^\s[0-9]+\s//" -e "s/;\s*aler$ alias alert='notify-send -i terminal "$(alert_helper)" "execution complete"'

    – atlaspaine Nov 14 '14 at 04:02

2 Answers2

0

Install and use libnotify-bin:

sudo apt install libnotify-bin

To run notify-send if the command ended successfully:

sudo apt install something && notify-send -i terminal "Last command" "ended successfully"

To run it either way, use ; instead. To do something like what @Panther answer:

notify-send -i terminal "$(bash -c ls -l | tail -1)" "execution complete"
Pablo Bianchi
  • 15,657
0

You format text with html code

notify-send -i terminal "<font size=16 color=blue><b><i>'bash -c ls'</b></i></font>"  "execution complete"

change what is in the single quotes with the command you wish, feel free to change the size and color to what you wish.

If you need assistance, post your code and more detailed information on what you wish to change

Panther
  • 102,067