Add comments to MOTD function

This commit is contained in:
Anthony Rose 2022-08-19 09:54:17 +01:00
parent 2c42757078
commit 42b33bf233

View file

@ -327,7 +327,11 @@ usermotd () {
return 1 return 1
fi fi
export _acp_motd_shown=1 export _acp_motd_shown=1
# OS (kernel) name and version in reverse video.
printf "\033[7m"; uname -sr; printf "\033[0m" printf "\033[7m"; uname -sr; printf "\033[0m"
# Distro name and version on Linux and macOS.
if [ -r /etc/os-release ] if [ -r /etc/os-release ]
then then
echo " $(. /etc/os-release; echo "$NAME" "$VERSION")" echo " $(. /etc/os-release; echo "$NAME" "$VERSION")"
@ -336,21 +340,31 @@ usermotd () {
then then
echo " $(sw_vers -productName) $(sw_vers -productVersion)" echo " $(sw_vers -productName) $(sw_vers -productVersion)"
fi fi
# System uptime and load averages.
uptime uptime
# Language for the shell.
echo "LANG=$LANG" echo "LANG=$LANG"
# Timezone.
if [ -n "$TZ" ] if [ -n "$TZ" ]
then then
echo "TZ=$TZ" echo "TZ=$TZ"
elif [ -x /usr/bin/timedatectl ] && [ "x$(systemctl is-system-running)" != "xoffline" ] elif [ -x /usr/bin/timedatectl ] && [ "$(systemctl is-system-running)" != offline ]
then then
timedatectl show --property=Timezone | sed 's/Timezone=/TZ=/' timedatectl show --property=Timezone | sed 's/Timezone=/TZ=/'
fi fi
# Shell name and version.
if [ -n "$BASH_VERSION" ] if [ -n "$BASH_VERSION" ]
then then
echo "bash $BASH_VERSION" echo "bash $BASH_VERSION"
elif [ -n "$ZSH_VERSION" ] elif [ -n "$ZSH_VERSION" ]
then then
echo "zsh $ZSH_VERSION" echo "zsh $ZSH_VERSION"
else
echo "shell unknown"
fi fi
} }