From fa852885e56d1f519a2efb07ea66d9828f00e84e Mon Sep 17 00:00:00 2001 From: ray Date: Tue, 22 Mar 2022 13:00:31 +0000 Subject: [PATCH] update --- bashrc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/bashrc b/bashrc index 1b9bb68..0b2b956 100644 --- a/bashrc +++ b/bashrc @@ -27,3 +27,34 @@ export NVM_DIR="$HOME/.nvm" # https://github.com/skywind3000/z.lua eval "$(lua $HOME/.z.lua/z.lua --init bash enhanced once echo)" + +_mem_available=$(awk '/MemAvailable/ { printf "%.1f \n", $2/1024/1024 }' /proc/meminfo) +_updates_available="$(cat $HOME/.checkupdates)" +[ -z $_updates_available ] && _updates_available="0" + +echo "Remember your aliases:" +echo " containers" +echo " e cdlf lfcd" +echo " mc newsh smartresize" +echo " b1 kvm mike p1 pve" +echo "" + +if [ ${_mem_available%.*} -lt 5 ] ; then + echo -n "Memory available: " + [ ${_mem_available%.*} -lt 3 ] && echo -ne "\033[0;31m" + echo -n "${_mem_available}" + [ ${_mem_available%.*} -lt 3 ] && echo -ne "\033[0m" + echo "GB" +fi + +if [ $_updates_available -gt 0 ] ; then + echo -n "Updates available: " + [ $_updates_available -gt 9 ] && echo -ne "\033[0;31m" + echo -n "$_updates_available" + [ $_updates_available -gt 9 ] && echo -ne "\033[0m" + echo "" +fi + +echo "" + +(checkupdates > "$HOME/.checkupdates") & disown