diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..7d03e25 --- /dev/null +++ b/.bash_profile @@ -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