I am trying to write a small (and rather simple) script to gather some info about the system and piping it to dzen2
first, i want to explain some things.
I know i could have used conky, but my intention was to expand my knowledge of bash, pipes and redirections inside a script, and to have fun (which i am)
some time later, i also decided to try to be more strict on the resource usage. this is a script that will constantly run on a low-end laptop.
also, dzen is not the important part of the script and can be simple ignored, is just a way to show the info. if you are interested in dzen, you can read more info here
gotmor - dzen
so, lets talk about the script itself
i use top in batch mode to get the list of most cpu/mem using, but now, i would like to include the total too. (in percentage)
with the memory, i was thinking maybe using free, and doing some math on the used/cached fields. but that would involve a new app to run, when top already gave me the info.
but taking the info from top's output will require a heavy use of pipes and secondary apps like tail and head
with the cpu%, well, im lost .....
where could i find that info?
im thinking, maybe is better to just use the iddle% field of top
this is what i have done so far
general pastebin - broli - post number 1091305
any suggestion on how to improve what i have done will also be welcomed