Bash Get Ip address?
Get Ip Address
만약 ethernet interface가 eth0 인 경우
$ IPADDR=$(ifconfig eth0|grep inet|head -1|sed 's/\:/ /'|awk '{print $2}')
$ echo $IPADDR
172.17.0.3
만약 ethernet interface가 eth0 인 경우
$ IPADDR=$(ifconfig eth0|grep inet|head -1|sed 's/\:/ /'|awk '{print $2}')
$ echo $IPADDR
172.17.0.3