Dotfiles config update (2022-04-15)
This commit is contained in:
parent
a6fe57c271
commit
0f123081fd
23
.bashrc
23
.bashrc
|
@ -160,11 +160,28 @@ else
|
|||
os_system=$(echo ${os_system})
|
||||
fi
|
||||
kernel=$(uname -r)
|
||||
uptime=$(uptime 2> /dev/null | tr -s " " | cut -d "," -f 1)
|
||||
if [ -z "${uptime}" ] ; then
|
||||
uptime="Unknown"
|
||||
if [ -f /proc/uptime ] ; then
|
||||
uptime_sec=$(cat /proc/uptime)
|
||||
uptime_sec_cut=$(echo ${uptime_sec} | tr -s " " | cut -d " " -f 1 | cut -d "." -f 1)
|
||||
uptime_min=$(expr ${uptime_sec_cut} / 60)
|
||||
if [ ${uptime_min} -le 59 ] ; then
|
||||
uptime="${uptime_min}min"
|
||||
else
|
||||
uptime_hour=$(expr ${uptime_min} / 60)
|
||||
if [ ${uptime_hour} -le 23 ] ; then
|
||||
uptime="${uptime_hour}h"
|
||||
else
|
||||
uptime_day=$(expr ${uptime_hour} / 24)
|
||||
uptime="${uptime_day}d"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
uptime=$(uptime 2> /dev/null | tr -s " " | cut -d "," -f 1)
|
||||
if [ -z "${uptime}" ] ; then
|
||||
uptime="Unknown"
|
||||
else
|
||||
uptime=$(echo ${uptime})
|
||||
fi
|
||||
fi
|
||||
#shell="5.1.4" # Run bash --version
|
||||
shell=$(bash --version | head -1 | tr -s " " | cut -d " " -f 4 | cut -d "(" -f 1 | cut -d "-" -f 1)
|
||||
|
|
|
@ -28,7 +28,22 @@ else
|
|||
set os_system (uname -o)
|
||||
end
|
||||
set kernel (uname -r)
|
||||
if test -f /usr/bin/uptime
|
||||
if test -f /proc/uptime
|
||||
set uptime_sec (cat /proc/uptime)
|
||||
set uptime_sec_cut (echo $uptime_sec | tr -s " " | cut -d " " -f 1 | cut -d "." -f 1)
|
||||
set uptime_min (expr $uptime_sec_cut / 60)
|
||||
if test "$uptime_min" -le "59"
|
||||
set uptime {$uptime_min}min
|
||||
else
|
||||
set uptime_hour (expr $uptime_min / 60)
|
||||
if test "$uptime_hour" -le "23"
|
||||
set uptime {$uptime_hour}h
|
||||
else
|
||||
set uptime_day (expr $uptime_hour / 24)
|
||||
set uptime {$uptime_day}d
|
||||
end
|
||||
end
|
||||
else if test -f /usr/bin/uptime
|
||||
set uptime (uptime | tr -s " " | cut -d "," -f 1)
|
||||
set uptime (echo {$uptime} | cut -f 2)
|
||||
else
|
||||
|
|
23
.zshrc
23
.zshrc
|
@ -252,11 +252,28 @@ echo ""
|
|||
echo -e -n "\e[32m# Preparing to start \e[0m\e[35mzsh\e[0m \e[32mshell...\e[0m"
|
||||
os_system=$(uname -o)
|
||||
kernel=$(uname -r)
|
||||
uptime=$(uptime 2> /dev/null | tr -s " " | cut -d "," -f 1)
|
||||
if [ -z "${uptime}" ] ; then
|
||||
uptime="Unknown"
|
||||
if [ -f /proc/uptime ] ; then
|
||||
uptime_sec=$(cat /proc/uptime)
|
||||
uptime_sec_cut=$(echo ${uptime_sec} | tr -s " " | cut -d " " -f 1 | cut -d "." -f 1)
|
||||
uptime_min=$(expr ${uptime_sec_cut} / 60)
|
||||
if [ ${uptime_min} -le 59 ] ; then
|
||||
uptime="${uptime_min}min"
|
||||
else
|
||||
uptime_hour=$(expr ${uptime_min} / 60)
|
||||
if [ ${uptime_hour} -le 23 ] ; then
|
||||
uptime="${uptime_hour}h"
|
||||
else
|
||||
uptime_day=$(expr ${uptime_hour} / 24)
|
||||
uptime="${uptime_day}d"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
uptime=$(uptime 2> /dev/null | tr -s " " | cut -d "," -f 1)
|
||||
if [ -z "${uptime}" ] ; then
|
||||
uptime="Unknown"
|
||||
else
|
||||
uptime=$(echo ${uptime})
|
||||
fi
|
||||
fi
|
||||
#shell="5.8" # Run zsh --version
|
||||
shell=$(zsh --version | cut -d " " -f 2)
|
||||
|
|
Loading…
Reference in New Issue
Block a user