Getting close now, test this

This commit is contained in:
inxi-svn 2008-11-21 21:17:21 +00:00
parent 9bba645d55
commit 45392d7153

12
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.6.0-b1-t11 #### version: 0.6.0-b1-t12
#### Date: November 20 2008 #### Date: November 20 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif #### 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() get_networking_local_ip_data()
{ {
if [[ -n $( which ifconfig ) ]];then if [[ -n $( which ifconfig ) ]];then
IFS=$'\n' IFS=$'\n'
A_INTERFACES_DATA=( $( ifconfig | gawk ' A_INTERFACES_DATA=( $( ifconfig | gawk '
@ -1829,7 +1827,6 @@ get_networking_local_ip_data()
$0 !~ /^lo/ { $0 !~ /^lo/ {
# not clear on why inet is coming through, but this gets rid of it # not clear on why inet is coming through, but this gets rid of it
# as first line item. # as first line item.
# if ( $1 !~ /^inet/ ) {
interface = $1 interface = $1
gsub(/,/, " ", interface) gsub(/,/, " ", interface)
gsub(/^ +| +$/, "", interface) gsub(/^ +| +$/, "", interface)
@ -1838,12 +1835,9 @@ get_networking_local_ip_data()
aInterfaces[interface]++ aInterfaces[interface]++
while (getline && !/^$/) { while (getline && !/^$/) {
if (/inet addr:/) { 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 ) ipAddresses[interface] = gensub( /addr:([0-9\.]+)/, "\\1", "g", $2 )
} }
} }
# }
# print ":" $0 ":"
} }
END { END {
@ -1855,7 +1849,8 @@ get_networking_local_ip_data()
useInterfaceIp = ipAddresses[i] useInterfaceIp = ipAddresses[i]
} }
# create array primary item for master array # 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 != "" ) { if ( useInterfaceIp != "" ) {
print a[j] "," useInterfaceIp print a[j] "," useInterfaceIp
} }
@ -1866,7 +1861,6 @@ get_networking_local_ip_data()
else else
A_INTERFACES_DATA=( "Interfaces requires ifconfig. App missing." ) A_INTERFACES_DATA=( "Interfaces requires ifconfig. App missing." )
fi fi
echo ${A_INTERFACES_DATA[@]}
} }
get_partition_data() get_partition_data()