Oops, made some typo, here is the correct version.
#!/bin/sh
# Find the first working network connection and
# configures it.
#
# Joel Bryan T. Juliano <email address hidden>
link="`/sbin/ifconfig | sed -e '/./{H;$!d;}' -e 'x;/[a-zA-Z][a-zA-Z][a-zA-Z]/!d;/RUNNING/!d;' \
| sed '/^[a-zA-Z][a-zA-Z][a-zA-Z]/!d' | sed -n '/^.\{15\}/p' | \
sed -ne 's/\([a-zA-Z][a-zA-Z][a-zA-Z][[:digit:]]\).*/\1/p'`"
test_current_link="`/sbin/ifconfig | sed -e '/./{H;$!d;}' -e 'x;/'$current_link'/!d;/RUNNING/!d;' \
| sed '/^[a-zA-Z][a-zA-Z][a-zA-Z]/!d' | sed -n '/^.\{15\}/p' | \
sed -ne 's/\([a-zA-Z][a-zA-Z][a-zA-Z][[:digit:]]\).*/\1/p'`"
if [ ! -s "$test_current_link" ]
then
/usr/bin/gconftool-2 -t string -s /apps/panel/applets/applet_0/prefs/interface "$link"
fi
Oops, made some typo, here is the correct version.
#!/bin/sh
# Find the first working network connection and
# configures it.
#
# Joel Bryan T. Juliano <email address hidden>
link="` /sbin/ifconfig | sed -e '/./{H;$!d;}' -e 'x;/[a- zA-Z][a- zA-Z][a- zA-Z]/! d;/RUNNING/ !d;' \ Z][a-zA- Z][a-zA- Z]/!d' | sed -n '/^.\{15\}/p' | \ zA-Z][a- zA-Z][a- zA-Z][[ :digit: ]]\).*/ \1/p'`"
| sed '/^[a-zA-
sed -ne 's/\([a-
current_ link="` /usr/bin/ gconftool- 2 -g /apps/panel/ applets/ applet_ 0/prefs/ interface` "
if [ ! "$link" = "$current_link" ]
then
test_current_ link="` /sbin/ifconfig | sed -e '/./{H;$!d;}' -e 'x;/'$current_ link'/! d;/RUNNING/ !d;' \ Z][a-zA- Z][a-zA- Z]/!d' | sed -n '/^.\{15\}/p' | \ zA-Z][a- zA-Z][a- zA-Z][[ :digit: ]]\).*/ \1/p'`"
| sed '/^[a-zA-
sed -ne 's/\([a-
if [ ! -s "$test_ current_ link" ] gconftool- 2 -t string -s /apps/panel/ applets/ applet_ 0/prefs/ interface "$link"
then
/usr/bin/
fi
exit 0;
fi