merge-hosts

/etc/hosts manager
git clone git://git.ckyln.com/~cem/merge-hosts.git
Log | Files | Refs | README | LICENSE

merge-hosts (294B)


      1 #!/usr/bin/env sh
      2 
      3 hostdir="/etc/hosts.d"
      4 hostfile="/etc/hosts"
      5 
      6 [ $(id -u ) -ne 0 ] && printf "Please run as root.\n" && exit 1
      7 [ -e "$hostfile" ] && cp "$hostfile" "$hostfile.bak"
      8 
      9 :> "${hostfile}"
     10 for file in "$hostdir/"* ; do
     11 	cat "$file" >> "$hostfile"
     12 done
     13 
     14 printf "Created $hostfile.\n"