Thank you for your awk code s0xxx, i'll study it for sure (:
This may not be equal to your code but i want to show what i have done to get "No ip" thing (:
I add if statement into for loop like;
Code:
for X in $name
do
ip=$(ifconfig $X | grep 'inet ' | awk '{print $2}')
status=$(ifconfig $X | grep status | awk -F ":" '{print $2}')
if [ ! -e $ip ]; then
echo "Interface Name: $X" "Ip Address: $ip" "Status: $status"
else
echo "Interface Name: $X" "Ip Address: No ip address" "Status: $status"
fi
done
and i got output;
Code:
Interface name: re0 IP address: 10.10.35.29 Status: active
Interface name: re1 IP address: No ip address Status: no carrier
i hope i done correct and hope to it can show a way to newbies like me (:
Best regards..