Linux命令——mesg
前言
在看一个脚本~/.profile 的时候发现了mesg命令以及一个奇怪用法
~/.profile
# ~/.profile: executed by Bourne-compatible login shells. if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi mesg n || true
meag命令
语法
mesg [ny]
功能
用来设置当前终端的写权限,即是否让其他用户向本终端发信息
参数
n 不允许其他用户将信息直接显示在你的屏幕上。
y 允许其他用户将信息直接显示在你的屏幕上。

演示
1) 如果mesg n设置为n的话,用write,talk命令时,会显示write permission turned off提示

2) 两个终端通过write命令发送讯息的过程

mesg n || true中 || true啥意思?
参考:What does the || true do in the mesg command do?
It forces the whole expression to exit with a success status: The operator "||" means the command to the right is only executed if the command beforehand exited with a "failure status" (exit code != 0). The "true" command does nothing but exit with exit code 0 which means "success".
简单翻一下
mesg n || true可以保证这句话退出状态是success。只有当||前面那句话执行失败,即mesg n 执行失败时,||后面才会执行。相当于||前面那句话退出码!0,现在变成0.
Linux命令——mesg的更多相关文章
- 运维工程师必会的109个Linux命令
运维工程师必会的109个Linux命令 版本1.0 崔存新 更新于2009-12-26 目录 1 文件管理 6 1.1 basename 6 1.2 cat 6 1.3 cd 7 1.4 chgrp ...
- linux 命令中英文对照,收集
linux 命令中英文对照,收集 linux 命令英文全文 Is Linux CLI case-sensitive? The answer is, yes. If you try to run L ...
- 《Linux命令学习手册》系列分享专栏
<Linux命令学习手册>系列分享专栏 <Linux命令学习手册>已整理成PDF文档,点击可直接下载至本地查阅https://www.webfalse.com/read/207 ...
- 十一、Linux 命令大全
Linux 命令大全 Linux 命令大全 1.文件管理 cat chattr chgrp chmod chown cksum cmp diff diffstat file find git gitv ...
- 【Linux】linux命令大全
[注意]:命令[compgen -b]可以列出所有当前系统支持的命令. 109个Linux命令 目录 1 文件管理... 5 1.1 basename. 5 1.2 ...
- Solaris/Linux 命令手册
无意翻到之前收藏的一个文档,共享一下. Solaris/Linux 命令手册 1. 系统 # passwd:修改口令 # exit:退出系统 2. 文件 # cp:复制文件或目录,参数:-a递归目录, ...
- Linux 命令大全提供 500 多个 Linux 命令搜索
Linux Command 在这里维持一个持续更新的地方 516 个 Linux 命令大全,内容包含 Linux 命令手册.详解.学习,值得收藏的 Linux 命令速查手册.请原谅我写了个爬虫,爬了他 ...
- Linux 命令、配置文件及操作
Linux 命令.配置文件及操作 命令 命令 参数 说明 A alias.unalias 命令别名 B C cat 查看文件内容 cd 切换目录 chown 修改拥有着 chgrp 修改所属组 chm ...
- 常用的Linux 命令
来源于面试 求一条linux命令:查找当前目录下所有含有字符串type="json",文件名以.xml的所有文件 find . -name "*.xml"|xa ...
随机推荐
- Flink 物理分区
本文来自官网: https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/stream/operators/#physical-p ...
- 【翻译】生成 Timestamps / Watermarks
本文翻译自flink官网:https://ci.apache.org/projects/flink/flink-docs-release-1.7/dev/event_timestamps_waterm ...
- Silence Removal and End Point Detection MATLAB Code
转载自:http://ganeshtiwaridotcomdotnp.blogspot.com/2011/08/silence-removal-and-end-point-detection.html ...
- sentinel搭建redis集群的注意事项
一.protected-mode 默认情况下,redis node和sentinel的protected-mode都是yes,在搭建集群时,若想从远程连接redis集群,需要将redis node和s ...
- DALFactory出现"未能加载文件或程序集“DAL”或它的某一个依赖项。系统找不到指定的文件”的解决方案 .
自己在使用抽象工厂+配置文件+反射实现重构机房的过程中,遇到了这种情况, 当初自己认真的检查了反射中的代码,都是没有问题,请教了师姐,检查了抽象工厂与反射的使用都没有问题 // 查找我们将要使用的数据 ...
- 17点睛Spring4.1-@Conditional
17.1 @Conditional @Conditional为按照条件配置spring的bean提供了支持,即满足某种条件下,怎么配置对应的bean; 应用场景 当某一个jar包在classpath中 ...
- .net core 使用SignalR实现实时通信
这几天在研究SignalR,网上大部分的例子都是聊天室,我的需求是把服务端的信息发送给前端展示.并且需要实现单个用户推送. 用户登录我用的是ClaimsIdentity,这里就不多解释,如果不是很了解 ...
- 进程间通信之pipe
实现数据传递 两个进程之间通信 多个进程之间通信,会导致数据不安全,需要加锁,示例 分类 无名管道:父子间进程通信 有名管道:父子间进程通信:任意两个进程之间通信 创建管道方法 os.mkfifo(p ...
- 【VS开发】windows下的signal
在windows下,信号机制简单来说是通过工作线程实现的,该线程运行于相对优先级THREAD_PRIORITY_HIGHEST,当信号产生时,windows生成该线程执行信号处理逻辑,由于该线程优先级 ...
- android基础---->数据保存到文件
Android使用与其他平台类似的基于磁盘的文件系统(disk-based file systems).这篇博客将描述如何在Android文件系统上使用File的读写APIs对Andorid的file ...