向Linux登录终端发消息

同一台服务器,可能有很多个用户登录在上面,每个用户都是一个系统终端,可以向其他终端发送消息,同在服务器上开发的开发人员可以简单的互动(不能回复)一下哈!

一,效果
先登录一个终端,如下:

[root@localhost /]# who
root     tty1         2013-02-16 18:14 (:0)
root     pts/0        2013-02-17 02:01 (:0.0)
[root@localhost /]# 

登录的终端为pts/0。然后再打开一个终端,如下:

[root@localhost /]# who
root     tty1         2013-02-16 18:14 (:0)
root     pts/0        2013-02-17 02:01 (:0.0)
root     pts/1        2013-02-17 02:02 (:0.0)
[root@localhost /]#

此时登录的终端为pts/1。现在假设pts/1发消息给pts/0。

[root@localhost /]# write root pts/0
hello

在pts/0终端上收到消息如下:

[root@localhost /]#  
Message from root@localhost.localdomain on pts/1 at 02:03 ...
hello

在pts/0上只是收到消息,不能回复的。
再看一下write命令的解释吧

WRITE(1)                         User Commands                         WRITE(1)

NAME
       write - send a message to another user

SYNOPSIS
       write user [ttyname]

DESCRIPTION
       Write  allows you to communicate with other users, by copying lines from
       your terminal to theirs.

       When you run the write command, the user you are writing to gets a  mes‐
       sage of the form:
   
              Message from yourname@yourhost on yourtty at hh:mm ...

aio_read未定义的引用

下载了一份代码学习,发现编不过,这里需要修改CMakeLists.txt,可以参考编译错误: 对‘aio_read’未定义的引用