Comment goes here
You should log in and post some comments! The link is up there in the toolbar. Go nuts!
 

Getting IP address by using shell script

As we known, being a staff of IT maintanance team, I used to get the IP address from the network configuration, I use this shell script to get the IP address:
[root@yoyojacky ~]# cat getip.sh
#!/bin/bash
# This script is for getting IP address from your local network configuration.

# 2013-02-25
# Email: yoyojacky2009@gmail.com
#

PATH=$PATH:/root/yoyojacky/bin
export PATH

ifconfig eth0 | grep "inet addr" | cut -d: -f2 | cut -d' ' -f1

[root@yoyojacky ~]#


# and also you can use this script: ifconfig eth0 | grep "inet addr" | awk -F: '{ print $2}' | awk -F' ' '{print $1 }'

# you can also get more from www.bizsmooth.com