motd #2
1 changed files with 30 additions and 0 deletions
30
.bash_profile
Normal file
30
.bash_profile
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
progress() {
|
||||||
|
value=$1
|
||||||
|
width=10
|
||||||
|
step_size=$((100 / $width))
|
||||||
|
num_of_progress_items=$(($value / $step_size))
|
||||||
|
|
||||||
|
printf '['
|
||||||
|
# if >= 90%, make it red
|
||||||
|
if [ $value -ge 90 ]; then printf '\033[1;31m'; fi
|
||||||
|
for i in $(seq 0 $width); do
|
||||||
|
[ $i -le $num_of_progress_items ] && printf '■' || printf ' '
|
||||||
|
done
|
||||||
|
printf '\033[0m' # reset color
|
||||||
|
printf ']'
|
||||||
|
}
|
||||||
|
|
||||||
|
space=$(zfs get -Ho value used,quota $HOME | paste - -)
|
||||||
|
used=$(echo $space | awk '{ print $1 }')
|
||||||
|
quota=$(echo $space | awk '{ print $2 }')
|
||||||
|
|
||||||
|
space_raw=$(zfs get -Hpo value used,quota $HOME | paste - -)
|
||||||
|
used_raw=$(echo $space_raw | awk '{ print $1 }')
|
||||||
|
quota_raw=$(echo $space_raw | awk '{ print $2 }')
|
||||||
|
pcent=$(((used_raw * 100) / quota_raw))
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Welcome to your LayerZero backup server! ^(;.;)^"
|
||||||
|
echo "Use the command `man suggestions` to see what you can do."
|
||||||
|
echo "Your disk usage: $used / $quota $(progress $pcent) $pcent%"
|
||||||
|
echo
|
Loading…
Reference in a new issue