如何将通知发送到与通知,发送给其他用户?巴什 [英] How to send a notification to another user with notify-send ? Bash

查看:149
本文介绍了如何将通知发送到与通知,发送给其他用户?巴什的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通知,发送显示与要显示自己的机器上的消息通知框。

notify-send display a notification box with the message 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?

推荐答案

Bash可以写入网络套接字,但不能听/看。你可以使用 GNU Netcat的此功能。

Bash can write to network sockets but can't listen/read. You could use GNU Netcat for this functionality.

一个网络通知阅读器监听10000端口(无安全性):

A network notify-reader listening on port 10000 (no security):

#!/bin/bash

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

这是一个相应的客户端:

An a corresponding client:

#!/bin/bash

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

所以,你可以使用发送邮件

So you can send messages using

notify-sender.sh  your-host message

这篇关于如何将通知发送到与通知,发送给其他用户?巴什的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆