Fix ips command for platforms without ifconfig

pull/496/head
Antti Ahti 2015-06-05 15:40:58 +03:00
parent 96c82fe460
commit fcbe9aa751
1 changed files with 9 additions and 1 deletions

View File

@ -5,7 +5,15 @@ function ips ()
{ {
about 'display all ip addresses for this host' about 'display all ip addresses for this host'
group 'base' group 'base'
ifconfig | awk '/inet /{ print $2 }' if command -v ifconfig &>/dev/null
then
ifconfig | awk '/inet /{ print $2 }'
elif command -v ip &>/dev/null
then
ip addr | grep -oP 'inet \K[\d.]+'
else
echo "You don't have ifconfig or ip command installed!"
fi
} }
function down4me () function down4me ()