Why using so many applications to get the IP Address?
You are using 4 applications when you do (single line):
Code:
ADDR=`/sbin/ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | sed -e s/.*://`
Why not only use 2 applications and do (single line also):
Code:
ADDR=`/sbin/ifconfig eth0 | sed -n '/inet addr:/s=[^:]*:\([^ ]*\).*=\1=;2p'`
To handle an unassigned address:
Code:
ADDR=`/sbin/ifconfig eth0 | sed -n '/inet addr:/p' | sed 's=[^:]*:\([^ ]*\).*=\1='`