From 5bd6dede93f3b4e79ca1b7b46b103337465325d5 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 21 Nov 2008 22:23:19 +0000 Subject: [PATCH] Fixed weak wan ip handling, using wget -q -O - now to send to stdout --- inxi | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/inxi b/inxi index 42c25c7..442af47 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.6.0-b1-t15 +#### version: 0.6.0-b1-t16 #### Date: November 20 2008 ######################################################################## #### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif @@ -38,7 +38,6 @@ #### Also the proc filesystem should be present and mounted #### #### RECOMMENDS (Needed to run certain features) -#### One of the following console browsers (for Wan IP test): elinks links links2 lynx w3m #### For local interfaces/IP test: ifconfig (in net-tools for Debian systems) ######################################################################## #### CONVENTIONS: @@ -676,7 +675,7 @@ show_options() print_screen_output "-f Show all cpu flags used, not just the short list. Not shown with -F to avoid spamming." print_screen_output "-F Show Full, all possible, output for $SCRIPT_NAME." print_screen_output "-G Show graphic card information (+ glx driver and version for non free video drivers)." - print_screen_output "-i Show Wan IP address and local interfaces if ifconfig is installed." + print_screen_output "-i Show Wan IP address, and shows local interfaces (requires ifconfig network tool)." print_screen_output " Not shown with -F for user security reasons, you shouldn't paste your local/wan IP." print_screen_output "-I Show information: processes, uptime, memory, irc client, inxi version." print_screen_output "-N Show network card information." @@ -1795,26 +1794,14 @@ get_networking_data() get_networking_wan_ip_data() { local extras_data='' ip='' use_browser='' browser='' - local browsers='elinks links links2 lynx w3m' - - # first find a browser to use, these all support -dump - for browser in $browsers - do - if [[ -n $( which $browser ) ]];then - use_browser=$browser - break - fi - done # get ip or show console browser missing error - if [[ -n $use_browser ]];then - ip=$( $use_browser -dump techpatterns.com/ip | awk -F 'is: ' '{ - #gsub("\n","",$2") - print $2 - }' ) - else - ip='Requires Console Browser!' - fi + + ip=$( wget -q -O - http://techpatterns.com/resources/ip.php | awk -F 'is: ' '{ + #gsub("\n","",$2") + print $2 + }' ) + if [[ -z $ip ]];then ip='None Detected!' fi