#!/bin/bash getip (){ /sbin/ifconfig ${1:-eth0} | egrep "([0-9]{1,3}\.){3}[0-9]{1,3}" } getip