Back
You need to write a script that only return the IP like:
/sbin/ifconfig eth0 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}'
For MAC:
ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2
Or for linux system
hostname -i | awk '{print $3}' # Ubuntu hostname -i # Debian
hostname -i | awk '{print $3}' # Ubuntu
hostname -i # Debian
To know about Linux join the Linux training
If you are a beginner, do check out the video below:
31k questions
32.8k answers
501 comments
693 users