2 ################################################################################
5 # Description: Makes an /etc/hosts file
6 # Author: Andrew@DeFaria.com
7 # Created: Thu Jun 3 17:21:24 PDT 1999
11 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
13 ################################################################################
17 adm_base=${adm_base:-$HOME/adm}
20 adm_fpath=${adm_fpath:-$adm_base/functions}
25 if [ $(/usr/xpg4/bin/id -u) -ne 0 ]; then
26 print -u2 "$me: Error: You must be root to use this command"
30 stdhosts=${stdhosts:-$adm_base/etc/stdhosts}
31 syshosts=${syshosts:-/etc/hosts}
32 localhosts=${localhosts:-/etc/hosts.local}
34 current_ip=$(nslookup $(hostname) | tail -2 | awk '{print $NF}')
36 cp $stdhosts $syshosts
38 if ! grep $(hostname) $syshosts > /dev/null; then
39 print "$current_ip\t$(hostname).cisco.com\t\t$(hostname)" >> $syshosts
42 if [ -f $localhosts ]; then
43 cat $localhosts >> $syshosts