I would like to right align the memory usage while keeping the services left aligned.
I'm using printf '%-1s %-25s %s\n' $ok $service $memory
and the result is:
[OK] gitea 142.2M
[OK] mariadb 73.0M
[OK] nginx 9.5M
I would like something more like this:
[OK] gitea 142.2M
[OK] mariadb 73.0M
[OK] nginx 9.5M
Edit
What about rendering these strings?
sdusage=88
cpuusage=5
swapusage=44
temp="50"
sdusagetext="SD usage is $sdusage%"
cpuusagetext="CPU usage is $cpuusage%"
swapusagetext="SWAP usaage is $swapusage%"
temptext="Temperature is $temp°C"
Is there a better approach than this one?
printf '%-1s %-3s %-26s %6s\n' $sdusagetext
printf '%-1s %-3s %-25s %6s\n' $cpuusagetext
printf '%-1s %-3s %-24s %6s\n' $swapusagetext
printf '%-1s %-24s %6s\n' $temptext