A network interface status script for GeekTool

Mar 20, '06 06:38:00AM

Contributed by: Anonymous

I love GeekTool and use it all over my desktop. So I thought that I'd share the script that I use to keep the status of my network interfaces on my desktop at all times. Please pardon the fact that it's written in csh, but I'm a long-time SunOS user, and that's what I use for most of my quick and dirty stuff.

Here's the code:


#! /bin/csh
# 2006 Beerguy's Reef - www.hopdog.com
#

foreach if(`ifconfig -a | grep ^en | awk '-F:' '{print $1}'`)

/sbin/ifconfig $if > /tmp/if-stat

set addr = `cat /tmp/if-stat | grep 'inet ' | awk '-F ' '{print $2}'`
set speed = `cat /tmp/if-stat | grep media | awk '-F: ' '{print $2" "$3}'| head -1`

echo $if": "$addr $speed
rm /tmp/if-stat
end

If you'd just like to download the script, you can grab it here. You can call it as a script from GeekTool, or just run it in a Terminal. The output looks like this:
en0: 10.0.1.11 autoselect (100baseTX <full-duplex>) status active
en2:  <unknown type> status inactive
[robg adds: This works as described...]

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060316161159908