Dotfiles config update (2022-10-22)

This commit is contained in:
q3aql 2022-10-22 18:39:01 +02:00
parent df1d76a72f
commit 864a6b78f4
3 changed files with 19 additions and 4 deletions

View File

@ -1,6 +1,7 @@
#!/bin/bash
# Configuration variables
python_bin="/usr/bin/python3"
memfile="/proc/meminfo"
size="G" # Change to M for MiB
@ -12,7 +13,11 @@ memActive=$(expr ${memTotal} - ${memActive})
# Variables to calculate
memTotalM=$(expr ${memTotal} / 1024 )
memActiveM=$(expr ${memActive} / 1024)
if [ -f /usr/bin/calc ] ; then
if [ -f ${python_bin} ] ; then
memPercentage=$(echo "n=${memActive}/${memTotal}*100 ; print(n)" | ${python_bin})
memTotalG=$(echo "n=${memTotalM}/1024 ; print(n)" | ${python_bin} | tr -s " " | cut -c1-4)
memActiveG=$(echo "n=${memActiveM}/1024 ; print(n)" | ${python_bin} | tr -s " " | cut -c1-4)
elif [ -f /usr/bin/calc ] ; then
memPercentage=$(calc ${memActive} / ${memTotal} \* 100)
memTotalG=$(calc ${memTotalM} / 1024 | tr -s " " | cut -c1-5)
memActiveG=$(calc ${memActiveM} / 1024 | tr -s " " | cut -c1-5)

View File

@ -1,6 +1,7 @@
#!/bin/bash
# Configuration variables
# Configuration variable
python_bin="/usr/bin/python3"
memfile="/proc/meminfo"
size="G" # Change to M for MiB
@ -12,7 +13,11 @@ memActive=$(expr ${memTotal} - ${memActive})
# Variables to calculate
memTotalM=$(expr ${memTotal} / 1024 )
memActiveM=$(expr ${memActive} / 1024)
if [ -f /usr/bin/calc ] ; then
if [ -f ${python_bin} ] ; then
memPercentage=$(echo "n=${memActive}/${memTotal}*100 ; print(n)" | ${python_bin})
memTotalG=$(echo "n=${memTotalM}/1024 ; print(n)" | ${python_bin} | tr -s " " | cut -c1-4)
memActiveG=$(echo "n=${memActiveM}/1024 ; print(n)" | ${python_bin} | tr -s " " | cut -c1-4)
elif [ -f /usr/bin/calc ] ; then
memPercentage=$(calc ${memActive} / ${memTotal} \* 100)
memTotalG=$(calc ${memTotalM} / 1024 | tr -s " " | cut -c1-5)
memActiveG=$(calc ${memActiveM} / 1024 | tr -s " " | cut -c1-5)

View File

@ -1,6 +1,7 @@
#!/bin/bash
# Configuration variables
python_bin="/usr/bin/python3"
memfile="/proc/meminfo"
size="G" # Change to M for MiB
@ -12,7 +13,11 @@ memActive=$(expr ${memTotal} - ${memActive})
# Variables to calculate
memTotalM=$(expr ${memTotal} / 1024 )
memActiveM=$(expr ${memActive} / 1024)
if [ -f /usr/bin/calc ] ; then
if [ -f ${python_bin} ] ; then
memPercentage=$(echo "n=${memActive}/${memTotal}*100 ; print(n)" | ${python_bin})
memTotalG=$(echo "n=${memTotalM}/1024 ; print(n)" | ${python_bin} | tr -s " " | cut -c1-4)
memActiveG=$(echo "n=${memActiveM}/1024 ; print(n)" | ${python_bin} | tr -s " " | cut -c1-4)
elif [ -f /usr/bin/calc ] ; then
memPercentage=$(calc ${memActive} / ${memTotal} \* 100)
memTotalG=$(calc ${memTotalM} / 1024 | tr -s " " | cut -c1-5)
memActiveG=$(calc ${memActiveM} / 1024 | tr -s " " | cut -c1-5)