Merge pull request #496 from apaatsio/ifconfig-fix

Fix ips command for platforms without ifconfig
This commit is contained in:
Nils Winkler
2015-06-05 21:16:55 +02:00

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 ()