All pastes #1971330 Raw Edit

Unnamed

public shellscript v1 · immutable
#1971330 ·published 2010-10-23 22:59 UTC
rendered paste body
#!/bin/bashwid=0extip=`lynx -dump "http://checkip.dyndns.org" | grep -o --extended-regexp "([0-9]{1,3}\.){3}[0-9]{1,3}"`if (( "${#extip}" > $wid )); then#	echo "check 1 $wid"	wid=${#extip}fiexthost=`host $extip | grep -o --extended-regexp "[^ ]*$" | grep -o --extended-regexp ".*[^\.]"`if (( "${#exthost}" > $wid )); then#        echo "check 2 $wid"        wid=${#exthost}fiintip=`sudo ifconfig | grep -o --extended-regexp "inet addr.([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -o --extended-regexp "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v --extended-regexp "127\.([0-9]{1,3}\.){2}[0-9]{1,3}"`if (( "${#intip}" > $wid )); then#        echo "check 3 $wid"        wid=${#intip}fi#echo $widwid=$(( $wid + 17 ))echo -n "wid is: "echo $widline=""count=0while (( $count < $wid )); do	line="$line"	count=$(($count+1))doneline="$line"echo $lineif (( $(( $wid&1 )) == 0 )); then #check if number is even	side=$(( $(($wid - 8)) / 2))	text="IP INFO"else	side=$(( $(($wid - 7)) /2))	text="IP INFO"ficount=0line=""while (( $count < $side )); do        line="$line"        count=$(($count+1))doneecho -n ""echo -n $lineecho -n $textecho -n $lineecho ""line=""count=0while (( $count < $wid )); do        line="$line"        count=$(($count+1))doneline="$line"echo $linetemp=$(($wid - ${#extip} - 16))count=0line=""while (( $count < $temp )); do	line="$line"	count=$(($count+1))doneline="$line"echo -n "   External IP: "echo -n $extipecho  $lineecho -n ""temp=$(($wid - ${#exthost} - 16))count=0line=""while (( $count < $temp )); do        line="$line"        count=$(($count+1))doneline="$line"echo -n " External Host: "echo -n $exthostecho $lineline=""count=0while (( $count < $wid )); do        line="$line"        count=$(($count+1))doneline="$line"echo $linetemp=$(($wid - ${#intip} - 16))count=0line=""while (( $count < $temp )); do        line="$line"        count=$(($count+1))doneline="$line"echo -n "   Internal IP: "echo -n $intipecho $lineline=""count=0while (( $count < $wid )); do        line="$line"        count=$(($count+1))doneline="$line"echo $line