Skip to content

Instantly share code, notes, and snippets.

@mario21ic
Created February 28, 2017 13:56
Show Gist options
  • Save mario21ic/621b01165255d627da45ac340e944d3f to your computer and use it in GitHub Desktop.
Save mario21ic/621b01165255d627da45ac340e944d3f to your computer and use it in GitHub Desktop.
Script to add hosts into /etc/hosts from source file
#!/bin/bash
IP=$1
LINE_RESULT=$IP" "
while read line; do
LINE_RESULT=$LINE_RESULT" "$line
done < $2
sudo echo $LINE_RESULT >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment