#!/bin/bash VAR="eth0" HOST_IP=$(ifconfig $VAR | grep "inet addr" | awk '{ print $2}' | awk -F: '{print $2}') echo $HOST_IP