Merge pull request #496 from apaatsio/ifconfig-fix

Fix ips command for platforms without ifconfig
pull/497/head
Nils Winkler 2015-06-05 21:16:55 +02:00
commit 959acc94ae
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'
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 ()