#!/bin/sh
IP=/bin/ip
SED=/bin/sed
CUT=/usr/bin/cut
IF=en0
if [ ! -z ${1} ]
then
IF=${1}
fi
$IP addr show dev $IF | $SED -n 3p | $SED -e 's/\ \+/\ /g' -e 's/\/.*$//g' | $CUT -d ' ' -f 3
Tomado de: http://tonejito.blogspot.com.ar/2012/03/show-my-ip-address.html
No hay comentarios:
Publicar un comentario