Peter Vollmar --> dwm (2008-01-15 12:06:19 +0100): [...] > So in short, I haven't been able to implement your "loop in a loop" > script in my .xinitrc, because I don't understand much of its syntax. > Can you please help me? > > Here's your snippet again: > > for (i=0; ; i=(i+1)%m) { > execute non-fetchmail commands > if (!i) execute fetchmail > sleep for n seconds > } > > And this is my .xinitrc: > > ... > while true > do > echo `uptime | sed 's/.*,//'` `date +'%a %d %b %R'` `fetchmail -c > --sslproto tls |sed 's/(//'|awk '{print $1-$3}'` > sleep 2 > done | dwm
Rereading your original message again I noticed that you're using the in.sh script I once posted to this list (IIRC). Have a [1]look at the version I'm currently using, maybe it fits you needs: it runs some commands (date, uptime) every $DELAY seconds, and - iff $MCK is not set to 'no' - a mail check command every $DELAY * $MCK_INT seconds. DELAY, MCK and MCK_INT can be overriden using environment variables, i.e. you can override the defaults given in the script (10, 'no', 6) like this: MCK=yes DELAY=5 MCK_INT=12 /path/to/in.sh /path/to/fifo The mail check command (`mck -q') used in the script is another script which calls `fetchmail -c' and pipes its output through [3]mck.awk. HTH, Jukka [1] http://salmi.ch/cgi-bin/cvs/tools/dwm/in.sh [2] http://salmi.ch/cgi-bin/cvs/tools/mail/mck [3] http://salmi.ch/cgi-bin/cvs/tools/mail/mck.awk -- bashian roulette: $ ((RANDOM%6)) || rm -rf ~