mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
Getting close now, test this
This commit is contained in:
parent
9bba645d55
commit
45392d7153
30
inxi
30
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.6.0-b1-t11
|
||||
#### version: 0.6.0-b1-t12
|
||||
#### Date: November 20 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
|
||||
|
@ -1820,8 +1820,6 @@ get_networking_wan_ip_data()
|
|||
|
||||
get_networking_local_ip_data()
|
||||
{
|
||||
|
||||
|
||||
if [[ -n $( which ifconfig ) ]];then
|
||||
IFS=$'\n'
|
||||
A_INTERFACES_DATA=( $( ifconfig | gawk '
|
||||
|
@ -1829,21 +1827,17 @@ get_networking_local_ip_data()
|
|||
$0 !~ /^lo/ {
|
||||
# not clear on why inet is coming through, but this gets rid of it
|
||||
# as first line item.
|
||||
# if ( $1 !~ /^inet/ ) {
|
||||
interface = $1
|
||||
gsub(/,/, " ", interface)
|
||||
gsub(/^ +| +$/, "", interface)
|
||||
gsub(/ [ \t]+/, " ", interface)
|
||||
interface = $1
|
||||
gsub(/,/, " ", interface)
|
||||
gsub(/^ +| +$/, "", interface)
|
||||
gsub(/ [ \t]+/, " ", interface)
|
||||
|
||||
aInterfaces[interface]++
|
||||
while (getline && !/^$/) {
|
||||
if (/inet addr:/) {
|
||||
#ipAddresses[interface] = gensub( /addr:([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})/, "\\1", "g", $2 )
|
||||
ipAddresses[interface] = gensub( /addr:([0-9\.]+)/, "\\1", "g", $2 )
|
||||
}
|
||||
aInterfaces[interface]++
|
||||
while (getline && !/^$/) {
|
||||
if (/inet addr:/) {
|
||||
ipAddresses[interface] = gensub( /addr:([0-9\.]+)/, "\\1", "g", $2 )
|
||||
}
|
||||
# }
|
||||
# print ":" $0 ":"
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
|
@ -1855,7 +1849,8 @@ get_networking_local_ip_data()
|
|||
useInterfaceIp = ipAddresses[i]
|
||||
}
|
||||
# create array primary item for master array
|
||||
# tested needed to avoid bad data from above
|
||||
# tested needed to avoid bad data from above, if null it is garbage
|
||||
# this is the easiest way to handle junk I found, improve if you want
|
||||
if ( useInterfaceIp != "" ) {
|
||||
print a[j] "," useInterfaceIp
|
||||
}
|
||||
|
@ -1866,7 +1861,6 @@ get_networking_local_ip_data()
|
|||
else
|
||||
A_INTERFACES_DATA=( "Interfaces requires ifconfig. App missing." )
|
||||
fi
|
||||
echo ${A_INTERFACES_DATA[@]}
|
||||
}
|
||||
|
||||
get_partition_data()
|
||||
|
|
Loading…
Reference in a new issue