Dotfiles config update (2022-04-15)
This commit is contained in:
parent
a6fe57c271
commit
0f123081fd
17
.bashrc
17
.bashrc
|
@ -160,12 +160,29 @@ else
|
||||||
os_system=$(echo ${os_system})
|
os_system=$(echo ${os_system})
|
||||||
fi
|
fi
|
||||||
kernel=$(uname -r)
|
kernel=$(uname -r)
|
||||||
|
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)
|
uptime=$(uptime 2> /dev/null | tr -s " " | cut -d "," -f 1)
|
||||||
if [ -z "${uptime}" ] ; then
|
if [ -z "${uptime}" ] ; then
|
||||||
uptime="Unknown"
|
uptime="Unknown"
|
||||||
else
|
else
|
||||||
uptime=$(echo ${uptime})
|
uptime=$(echo ${uptime})
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
#shell="5.1.4" # Run bash --version
|
#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)
|
shell=$(bash --version | head -1 | tr -s " " | cut -d " " -f 4 | cut -d "(" -f 1 | cut -d "-" -f 1)
|
||||||
resolution=$(xrandr 2> /dev/null | grep "*" | head -1 | tr -s " " | cut -d " " -f 2)
|
resolution=$(xrandr 2> /dev/null | grep "*" | head -1 | tr -s " " | cut -d " " -f 2)
|
||||||
|
|
|
@ -28,7 +28,22 @@ else
|
||||||
set os_system (uname -o)
|
set os_system (uname -o)
|
||||||
end
|
end
|
||||||
set kernel (uname -r)
|
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 (uptime | tr -s " " | cut -d "," -f 1)
|
||||||
set uptime (echo {$uptime} | cut -f 2)
|
set uptime (echo {$uptime} | cut -f 2)
|
||||||
else
|
else
|
||||||
|
|
17
.zshrc
17
.zshrc
|
@ -252,12 +252,29 @@ echo ""
|
||||||
echo -e -n "\e[32m# Preparing to start \e[0m\e[35mzsh\e[0m \e[32mshell...\e[0m"
|
echo -e -n "\e[32m# Preparing to start \e[0m\e[35mzsh\e[0m \e[32mshell...\e[0m"
|
||||||
os_system=$(uname -o)
|
os_system=$(uname -o)
|
||||||
kernel=$(uname -r)
|
kernel=$(uname -r)
|
||||||
|
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)
|
uptime=$(uptime 2> /dev/null | tr -s " " | cut -d "," -f 1)
|
||||||
if [ -z "${uptime}" ] ; then
|
if [ -z "${uptime}" ] ; then
|
||||||
uptime="Unknown"
|
uptime="Unknown"
|
||||||
else
|
else
|
||||||
uptime=$(echo ${uptime})
|
uptime=$(echo ${uptime})
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
#shell="5.8" # Run zsh --version
|
#shell="5.8" # Run zsh --version
|
||||||
shell=$(zsh --version | cut -d " " -f 2)
|
shell=$(zsh --version | cut -d " " -f 2)
|
||||||
resolution=$(xrandr 2> /dev/null | grep "*" | head -1 | tr -s " " | cut -d " " -f 2)
|
resolution=$(xrandr 2> /dev/null | grep "*" | head -1 | tr -s " " | cut -d " " -f 2)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user