How do I send a notification to another user with a send notification? Bash

notify-send displays a message box that you want to display on your own machine.

Is there a way to use notify-send to send a notification message to another user and display the message on his machine?

+3
source share
1 answer

Bash can write to network sockets, but cannot listen / read. You can use GNU Netcat for this feature .

Network Notification Reader Listening on Port 10000 (Unsecured):

#!/bin/bash

# no multiple connections: needs to improve
while true; do
    line="$(netcat -l -p 10000)"
    notify-send -- "Received Message" "$line"
done

Relevant customer:

#!/bin/bash

host="$1"
echo "$@" >/dev/tcp/$host/10000

This way you can send messages using

notify-sender.sh  your-host message
+7
source

Source: https://habr.com/ru/post/1742516/


All Articles