通知发送显示一个通知框,其中包含要在自己的计算机上显示的消息。
是否有方法使用notify send向其他用户发送通知消息并在其计算机上显示该消息?
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 message