On Tue, Oct 13, 2009 at 03:27:00PM +0200, Tobias Heer wrote: > > Log: > Modified the iwlist parser and supplemented it with a handover script > > Added: > trunk/tools/auto-handover.sh (contents, props changed) > trunk/tools/iwlist_parser.c (contents, props changed) > - copied, changed from r1073, trunk/tools/iwlist_parser.cc > Deleted: > trunk/tools/iwlist_parser.cc \o/ This converts a C++ file to C, that's always good news ;) > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ trunk/tools/auto-handover.sh Tue Oct 13 15:27:00 2009 (r1113) > @@ -0,0 +1,33 @@ > +#!/bin/bash :-/ > +result=($(iwlist $WIFI_IF scan | ./piwlist -s $PATTERN)) Is there a reason for running this in a subshell? > +while [ 1 ] > +do while true; do is POSIX-compatible syntax. > +if [ "${result[0]}" == "NONE" ] > + if [ "$last_result" != "${result[0]}" ] > + echo "Changing to " ${result[1]} > + iwconfig $WIFI_IF ap ${result[0]} essid ${result[1]} > + last_result=${result[0]} Your shell scripts always remind me a lot of C programs, but shell programming is not C programming. Don't try to work in terms of arrays or for loops that have integer counters. Your style of writing if ... then while ... do for ... do on two lines is correct syntax but rather weird style that I have never before seen used outside of the HIP source tree. The more common style is if ...; then while ...; do for ...; do Diego