Snippets

Aryel Tupinambá CLI tool to add entry to hosts for Homestead

Created by Aryel Tupinambá

File host_add.sh Added

  • 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
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.