I need to display the result of a terminal command in notification.
Notifications can be triggered by running:
notify-send "Notification message"
The command I have is:
sudo /opt/lampp/xampp start
which shows the following result in terminal:
Starting XAMPP for Linux 5.6.20-0...
XAMPP: Starting Apache...already running.
XAMPP: Starting MySQL...already running.
XAMPP: Starting ProFTPD...already running.
I want this result to be displayed in notification just like "Notification message" is displayed with notify-send
.
Thanks!
Best Answer
In most cases you can use
notify-send
with command substitution$()
. For example:Inside a scrip you can use a function to wrap the entire output:
If you need to run that function with
sudo
: