Re: [dev] daemon for DWM

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Sun, 28 Jul 2013 18:11:39 +0200

Am 2013-07-27 18:27, schrieb Martti Kühne:
> On Mon, Jul 22, 2013 at 3:17 PM, Markus Teich
> <markus.teich_AT_stusta.mhn.de> wrote:
>>
>> rx_now=0
>> tx_now=0
>> for i in /sys/class/net/*; do
>> if [[ -d "$i" && ${i##*/} != "lo" ]]; then
>> if [[ -f "$i/statistics/rx_bytes" ]]; then
>> rx_now=($rx_now+`cat $i/statistics/rx_bytes`)
>> fi
>> if [[ -f "$i/statistics/tx_bytes" ]]; then
>> tx_now=($tx_now+`cat $i/statistics/tx_bytes`)
>> fi
>> fi
>> done
>> let rx_rate=($rx_now-$rx_old)
>> let tx_rate=($tx_now-$tx_old)
>>
> Might I ask what shell dialect is that written in? O_o

Bash patched together with some stackoverflow answers.
It probably is not beautiful, but it works for me until I finally have
the time to write it in C. :/

--Markus
Received on Sun Jul 28 2013 - 18:11:39 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 28 2013 - 18:24:02 CEST