Motd (简体中文) - ArchWiki

# Motd (简体中文)

This article is a stub.

Notes: please use the first argument of the template to provide more detailed indications. (Discuss)

motd (Message of the day). `/etc/motd` 内容会在成功登录之后通过 `login(1)` 显示，但是只在启动 login shell 之前显示。

这是显示你的服务条款的好地方，你可以提醒用户条款和政策，或者其他想要用户了解的信息。 一个简单的脚本：

    #!/bin/bash
    #define the filename to use as output
    motd="/etc/motd"
    # Collect useful information about your system
    # $USER is automatically defined
    HOSTNAME=`uname -n`
    KERNEL=`uname -r`
    CPU=`uname -p`
    ARCH=`uname -m`
    # The different colours as variables
    W="\033[01;37m"
    B="\033[01;34m"
    R="\033[01;31m"
    X="\033[00;37m"
    clear > $motd # to clear the screen when showing up
    echo -e "$R#=============================================================================#" >> $motd
    echo -e "	$W Welcome $B $USER $W to $B $HOSTNAME                " >> $motd
    echo -e "	$R ARCH   $W= $ARCH                                   " >> $motd
    echo -e "	$R KERNEL $W= $KERNEL                                 " >> $motd
    echo -e "	$R CPU    $W= $CPU                                    " >> $motd
    echo -e "$R#=============================================================================#" >> $motd
    echo -e "$X" >> $motd

Categories:

- Software (简体中文)
- 简体中文