Auto Host File Entry
- Tags:
Automatically build an /etc/hosts entry...
sudo /sbin/ifconfig eth1 | grep -o "inet addr:[0-9.]*" | awk -v dn=`hostname` -v fqdn=`hostname -f` -F ":" '{print $2 "\t" dn "\t" fqdn}'
Escaped for use via SSH...
ssh root@myserver01 "sudo /sbin/ifconfig eth0 | grep -o 'inet addr:[0-9.]*' | awk -v dn=\`hostname\` -v fqdn=\`hostname -f\` -F ':' '{print \$2 \"\\t\" dn \"\\t\" fqdn}'"
