1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#! /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"
|