I'm reading my machines cpu load however the results aren't updating and the first result is constantly displayed.
#!/bin/bash
LOAD=$(ps aux|awk 'NR > 0 { s +=$3 }; END {print s"%"}')
(while true; do
echo "$LOAD"
sleep 1
done)
this returns
0.3%
0.3%
0.3%
0.3%
0.3%
even though the load has changed during this time