There is a one-line pipeline of commands to get IP address assigned to a specified interface. For example to eth0:
ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'