Currently I use two different while loops to start my window manager, dwm, and the status bar that prints system info to it.
My solution at the moment is to run them consecutively in the same script, like so:
while true; do
$HOME/Scripts/dwm-status
sleep 2s
done &
while true; do
dwm >/dev/null
done
I have also seen it run as a nested while loop, like this:
while true; do
while true; do
$HOME/Scripts/dwm-status
sleep 2s
done &
dwm >/dev/null
done
The second seems to cause CPU spikes. In terms of efficiency (least call on resources etc.,) what is the best approach to run these two loops and why?