diff --git a/inxi b/inxi index a018459..955b01f 100755 --- a/inxi +++ b/inxi @@ -1066,7 +1066,7 @@ get_audio_data() else { a[j]=i # little trick here to try to catch the driver if there is - # only one card + # only one card and it was null, from the first function if (drivers[i] != "") { useDrivers=drivers[i] } @@ -2179,7 +2179,7 @@ print_short_data() print_audio_data() { local i='' card_one='Card-1 ' audio_data='' a_audio_data='' port_data='' - local a_audio_working='' alsa_driver='' alsa_data='' + local a_audio_working='' alsa_driver='' alsa_data='' port_plural='' # set A_AUDIO_DATA and get alsa data get_audio_data alsa_data=$( get_audio_alsa_data ) @@ -2201,7 +2201,10 @@ print_audio_data() alsa_driver=" ${C1}driver${C2} ${a_audio_working[1]}" fi if [[ -n ${a_audio_working[2]} && $B_EXTRA_DATA == 'true' ]];then - port_data="${C1}at port${C2} ${a_audio_working[2]}" + if [[ $( wc -w <<< ${a_audio_working[2]} ) -gt 1 ]];then + port_plural='s' + fi + port_data="${C1}at port$port_plural${C2} ${a_audio_working[2]}" fi audio_data="${C1}$card_one${C2}${a_audio_working[0]}$alsa_driver$port_data" audio_data=$( create_print_line "Audio:" "$audio_data" ) @@ -2212,17 +2215,19 @@ print_audio_data() IFS="," a_audio_working=( ${A_AUDIO_DATA[i]} ) IFS="$ORIGINAL_IFS" -# port_data='' + port_data='' alsa_driver='' -# if [[ ${a_audio_working[2]} == 'port' ]];then -# port_data=" ${C1}at port${C2} ${a_audio_working[2]}" -# fi + port_plural='' + # we're testing for the presence of the 2nd array item here, which is the driver name if [[ -n ${a_audio_working[1]} ]];then alsa_driver="${C1}driver${C2} ${a_audio_working[1]}" fi if [[ -n ${a_audio_working[2]} && $B_EXTRA_DATA == 'true' ]];then - port_data="${C1}at port${C2} ${a_audio_working[2]}" + if [[ $( wc -w <<< ${a_audio_working[2]} ) -gt 1 ]];then + port_plural='s' + fi + port_data="${C1}at port$port_plural${C2} ${a_audio_working[2]}" fi if [[ -n ${a_audio_working[0]} ]];then audio_data="${C1}Card-$(( $i + 1 )) ${C2}${a_audio_working[0]}$alsa_driver$port_data"