Replies: 3 comments 6 replies
-
google://escape character in lua |
Beta Was this translation helpful? Give feedback.
-
Thanks. It was solved by rewriting it in another way:
|
Beta Was this translation helpful? Give feedback.
-
also, that's offtopic from the point of your question, regarding escape characters, but i'd suggest to use short load average value instead of momentary utilization %: bash -c 'echo scale=2\; $(cat /proc/loadavg | cut -d" " -f1) / $(nproc) | bc | sed "s/^\./0./g"' or, to display it as %: bash -c 'echo scale=2\; $(cat /proc/loadavg | cut -d" " -f1) / $(nproc) "*" 100 | bc | sed "s/^\./0./g"' 100% would mean full utilization of all cpus/cores, and >100% would mean that amount of processes is more than current cpus could handle, so some of them are queued |
Beta Was this translation helpful? Give feedback.
-
I have the following command to display CPU utilisation:
top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}'
I can run it from terminal like so:
bash -c "top -bn1 | grep Cpu\\(s\\) | sed --expression=\"s/.*, *\\([0-9.]*\\)%* id.*/\1/\""
But when I put it inside awesome, I get an empty string:
myCPUusage = awful.widget.watch('bash -c "top -bn1 | grep Cpu\\(s\\) | sed \"s/.*, *\\([0-9.]*\\)%* id.*/\1/\""', 1)
Is there an alternative way of evaluating complex commands?
Beta Was this translation helpful? Give feedback.
All reactions