From 42b33bf233ba06aa4d1b49ae298f82107f60e98a Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Fri, 19 Aug 2022 09:54:17 +0100 Subject: [PATCH] Add comments to MOTD function --- roles/home-cli/files/bashrc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/roles/home-cli/files/bashrc b/roles/home-cli/files/bashrc index ecadfea..7bcd6ad 100644 --- a/roles/home-cli/files/bashrc +++ b/roles/home-cli/files/bashrc @@ -327,7 +327,11 @@ usermotd () { return 1 fi export _acp_motd_shown=1 + + # OS (kernel) name and version in reverse video. printf "\033[7m"; uname -sr; printf "\033[0m" + + # Distro name and version on Linux and macOS. if [ -r /etc/os-release ] then echo " $(. /etc/os-release; echo "$NAME" "$VERSION")" @@ -336,21 +340,31 @@ usermotd () { then echo " $(sw_vers -productName) $(sw_vers -productVersion)" fi + + # System uptime and load averages. uptime + + # Language for the shell. echo "LANG=$LANG" + + # Timezone. if [ -n "$TZ" ] then 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 timedatectl show --property=Timezone | sed 's/Timezone=/TZ=/' fi + + # Shell name and version. if [ -n "$BASH_VERSION" ] then echo "bash $BASH_VERSION" elif [ -n "$ZSH_VERSION" ] then echo "zsh $ZSH_VERSION" + else + echo "shell unknown" fi }