added plural network ports

This commit is contained in:
inxi-svn 2008-11-21 19:59:30 +00:00
parent e853fed8ff
commit 9f64dfd4ab

15
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.6.0-b1-t9 #### version: 0.6.0-b1-t10
#### 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
@ -2422,7 +2422,7 @@ print_info_data()
print_networking_data() print_networking_data()
{ {
local i='' card_one='Card-1' network_data='' a_network_working='' port_data='' driver_data='' local i='' card_one='Card-1' network_data='' a_network_working='' port_data='' driver_data=''
local card_string='' local card_string='' port_plural=''
# set A_NETWORK_DATA # set A_NETWORK_DATA
get_networking_data get_networking_data
@ -2441,7 +2441,10 @@ print_networking_data()
driver_data=" ${C1}driver${C2} ${a_network_working[1]}" driver_data=" ${C1}driver${C2} ${a_network_working[1]}"
fi fi
if [[ -n ${a_network_working[2]} && $B_EXTRA_DATA == 'true' ]];then if [[ -n ${a_network_working[2]} && $B_EXTRA_DATA == 'true' ]];then
port_data=" ${C1}at port${C2} ${a_network_working[2]}" if [[ $( wc -w <<< ${a_network_working[2]} ) -gt 1 ]];then
port_plural='s'
fi
port_data=" ${C1}at port$port_plural${C2} ${a_network_working[2]}"
fi fi
card_string="" card_string=""
network_data="${C1}$card_one${C2} ${a_network_working[0]}$driver_data$port_data" network_data="${C1}$card_one${C2} ${a_network_working[0]}$driver_data$port_data"
@ -2455,11 +2458,15 @@ print_networking_data()
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
port_data='' port_data=''
driver_data='' driver_data=''
port_plural=''
if [[ -n ${a_network_working[1]} ]];then if [[ -n ${a_network_working[1]} ]];then
driver_data=" ${C1}driver${C2} ${a_network_working[1]}" driver_data=" ${C1}driver${C2} ${a_network_working[1]}"
fi fi
if [[ -n ${a_network_working[2]} && $B_EXTRA_DATA == 'true' ]];then if [[ -n ${a_network_working[2]} && $B_EXTRA_DATA == 'true' ]];then
port_data=" ${C1}at port${C2} ${a_network_working[2]}" if [[ $( wc -w <<< ${a_network_working[2]} ) -gt 1 ]];then
port_plural='s'
fi
port_data=" ${C1}at port$port_plural${C2} ${a_network_working[2]}"
fi fi
network_data="${C1}Card-$(( $i + 1 )) ${C2}${a_network_working[0]}$driver_data$port_data" network_data="${C1}Card-$(( $i + 1 )) ${C2}${a_network_working[0]}$driver_data$port_data"
network_data=$( create_print_line " " "$network_data" ) network_data=$( create_print_line " " "$network_data" )