motd.sh: fix last login display

This commit is contained in:
Alice Gaudon 2021-08-29 16:25:08 +02:00
parent 065455440d
commit f7e44cc48b

View File

@ -105,7 +105,7 @@ done <<< $(echo -e "$DISKS")
### Welcome message ### ### Welcome message ###
LAST_LOGIN=$(last -w | grep arisu | head -2 | tail -1) LAST_LOGIN=$(last -w --time-format iso | grep $(whoami) | head -2 | tail -1)
echo -e echo -e
echo -e "Welcome to $(hostname), $(whoami)! echo -e "Welcome to $(hostname), $(whoami)!
Last login: $(echo "$LAST_LOGIN" | awk '{for(i=4;i<=NF;i++) print $i}' | paste -sd ' ') from $(echo "$LAST_LOGIN" | awk '{print $3}')" Last login: $(echo "$LAST_LOGIN" | awk '{for(i=4;i<=NF;i++) print $i}' | paste -sd ' ') from $(echo "$LAST_LOGIN" | awk '{print $3}')"
@ -121,4 +121,4 @@ if test $(command -v zfs); then
echo -e "${red}Warning! ${white}$name ${undim}has less than 150GB" echo -e "${red}Warning! ${white}$name ${undim}has less than 150GB"
fi fi
done <<< $(echo -e "$POOLS") done <<< $(echo -e "$POOLS")
fi fi