#! /bin/sh ## ## Usage: %PROG% ## ## Display IP address using gxmessage ## # I, the Copyright holder of this work, hereby release it into the Public # Domain. This applies worldwide. In case this is not legally possible, I # grant anyone the right to use this work for any purpose, without any # conditions, unless such conditions are required by law. # # 2009 Timothy Richard Musson <trmusson@gmail.com> PROG=$(basename $0) MSG_TITLE='IP Address' XMESSAGE=${XMESSAGE:-$(which gxmessage)} || XMESSAGE=xmessage [ "$XMESSAGE" != xmessage ] && MSG_WRAP=-wrap showUsage () { sed -n '/^##/s/^## //p' $0 | sed -e "s#%PROG%#${PROG}#g" exit } [ "$1" = '-h' -o "$1" = '--help' ] && showUsage msg=$( /sbin/ifconfig ppp0 2>&1 ) && msg=$( echo "$msg" | sed -n 's/^[[:space:]]*inet addr:\([0-9.]\+\).*/\1/p' ) $XMESSAGE -center $MSG_WRAP \ -title "$MSG_TITLE" \ -buttons GTK_STOCK_CLOSE:0 \ -default GTK_STOCK_CLOSE \ "$msg"