参考:图解Linux命令之--mesg命令

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的更多相关文章

  1. 运维工程师必会的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 ...

  2. linux 命令中英文对照,收集

    linux 命令中英文对照,收集   linux 命令英文全文 Is Linux CLI case-sensitive? The answer is, yes. If you try to run L ...

  3. 《Linux命令学习手册》系列分享专栏

    <Linux命令学习手册>系列分享专栏 <Linux命令学习手册>已整理成PDF文档,点击可直接下载至本地查阅https://www.webfalse.com/read/207 ...

  4. 十一、Linux 命令大全

    Linux 命令大全 Linux 命令大全 1.文件管理 cat chattr chgrp chmod chown cksum cmp diff diffstat file find git gitv ...

  5. 【Linux】linux命令大全

    [注意]:命令[compgen -b]可以列出所有当前系统支持的命令. 109个Linux命令 目录 1       文件管理... 5 1.1          basename. 5 1.2    ...

  6. Solaris/Linux 命令手册

    无意翻到之前收藏的一个文档,共享一下. Solaris/Linux 命令手册 1. 系统 # passwd:修改口令 # exit:退出系统 2. 文件 # cp:复制文件或目录,参数:-a递归目录, ...

  7. Linux 命令大全提供 500 多个 Linux 命令搜索

    Linux Command 在这里维持一个持续更新的地方 516 个 Linux 命令大全,内容包含 Linux 命令手册.详解.学习,值得收藏的 Linux 命令速查手册.请原谅我写了个爬虫,爬了他 ...

  8. Linux 命令、配置文件及操作

    Linux 命令.配置文件及操作 命令 命令 参数 说明 A alias.unalias 命令别名 B C cat 查看文件内容 cd 切换目录 chown 修改拥有着 chgrp 修改所属组 chm ...

  9. 常用的Linux 命令

    来源于面试 求一条linux命令:查找当前目录下所有含有字符串type="json",文件名以.xml的所有文件 find . -name "*.xml"|xa ...

随机推荐

  1. [转]C++ STL中的Binary search(二分查找)

    链接地址:https://www.cnblogs.com/wkfvawl/p/9475939.html

  2. 深度技术W10系统中绑定MAC地址和IP地址的设置技巧

    深度技术W10系统中绑定MAC地址和IP地址的设置技巧分享给大家,感兴趣的用户,请一起来了解下,以备以后作参考,具体如下:1.点击“开始——搜索”,输入CMD命令,然后在CMD上右键选择以管理员身份运 ...

  3. js 次方 开方 对数

    次方 ,用Math.pow(值,次方数) 如: Math.pow(3,2);   3的平方 Math.Pow(2,3);   2的立方 开方Math.sqrt(值) 如: Math.sqrt(9);  ...

  4. Asp.Net Core中完成拒绝访问功能

    很多时候如果用户没有某个菜单的操作权限的话在页面是不应该显示出来的. @if (SignInManager.IsSignedIn(User) && User.IsInRole(&quo ...

  5. R画柱形图和箱线图

    数据格式如下 gene_id Sham-1 Sham-2 Sham-3 Sham-4 Sham-5 Rep-1h-1 Rep-1h-2 Rep-1h-3 Rep-1h-4 Rep-1h-5 Rep-3 ...

  6. Python3实现自动查询成绩(主要使用的包有Tesseract-OCR、PIL、execjs、pytesseract、BeautifulSoup)

    前提:本文仅作为技术训练,不可利用技术做非法的事. 某考试的成绩查询页面如下:查询成绩需要的数据有准考证号或者身份证.考生姓名.验证码.现在使用python来实现自动查询指定人员的考试成绩(不知道准考 ...

  7. [VS] - EntityFrameworkCore 2.0 安装失败 之解决

    背景 在 Visual Studio 2017 中,使用 Nuget 包管理器安装 EntityFrameworkCore 2.0 失败.切换至程序包控制器管理台,查看 Error Message: ...

  8. 记录MindSphere On Cloud Foundry的一次尝试过程

    试验背景: 开始时间:2019年12月11日 结束时间:2019年12月13日 自己编写一个后台程序,尝试推送到Cloud Foundry上,并开放从MindSphere以外访问的权限. 程序实现以下 ...

  9. C#导入Excel表格功能aspx.cs(代码)

    using System; using System.Data; using System.Configuration; using System.Collections; using System. ...

  10. dapper 参数不定时用这种方法动态参数

    string where = null; var p = new DynamicParameters(); if (classId != null) { where = " and clas ...