Created by Aryel Tupinambá 2015-11-20 View revision File host_add.sh Added Side-by-side diff More Ignore whitespace Hide word diff +#!/bin/bash +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +if [ -n "$1" ]; then + echo -e "\n192.168.10.10 \t $1" >> /etc/hosts; + echo "Added entry to hosts for: $1"; +else + echo "Missing parameter HOST_NAME"; +fi