ubuntu@ubuntu:~$ vim getlocalip.sh #!/bin/bash #ifconfig | grep inet | awk '$2' | awk -F : '$2' IP=`ifconfig | grep "inet addr:" |sed '/127/d' | awk '{print $2}' | awk -F : '{print $2}'` MASK=`ifconfig | grep "inet addr:" |sed '/127/d' | awk -F : '{print $4}'` echo $IP"/"$MASK