blob: a691c0ff884abbea1860034bcba297097485293d [file] [log] [blame]
vinayakb5d8a2f22013-01-29 19:45:44 +00001#get the OS
2OS_NAME=`uname -a|awk '{print $1}'`
3LINUX_OS='Linux'
4
5if [ $OS_NAME = $LINUX_OS ];
6then
7 #Get IP Address
8 IPADDR=`/sbin/ifconfig eth0 | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'`
buyingyia880ed92013-03-14 22:44:32 +00009 if [ "$IPADDR" = "" ]
10 then
11 IPADDR=`/sbin/ifconfig em1 | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'`
12 fi
vinayakb5d8a2f22013-01-29 19:45:44 +000013 if [ "$IPADDR" = "" ]
14 then
15 IPADDR=`/sbin/ifconfig lo | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'`
16 fi
17else
18 IPADDR=`/sbin/ifconfig en1 | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'`
19 if [ "$IPADDR" = "" ]
20 then
21 IPADDR=`/sbin/ifconfig lo0 | grep "inet " | awk '{print $2}' | cut -f 2 -d ':'`
22 fi
23
24fi
25echo $IPADDR