notify-send将显示一个通知框,其中包含要在您自己的计算机上显示的消息。
有没有办法使用notify-send向另一个用户发送通知消息并在他的机器上显示该消息?
发布于 2010-04-24 21:48:52
Bash可以写入网络套接字,但不能侦听/读取。您可以使用GNU Netcat来实现此功能。
侦听端口10000的网络通知读取器(无安全性):
#!/bin/bash
# no multiple connections: needs to improve
while true; do
line="$(netcat -l -p 10000)"
notify-send -- "Received Message" "$line"
done和对应的客户端:
#!/bin/bash
host="$1"
echo "$@" >/dev/tcp/$host/10000因此您可以使用以下命令发送消息
notify-sender.sh your-host messagehttps://stackoverflow.com/questions/2701059
复制相似问题