Skip to content

Instantly share code, notes, and snippets.

@anthonygelibert
Created February 25, 2021 21:00
Show Gist options
  • Save anthonygelibert/3cec372ef57f273aa1ceac671273c806 to your computer and use it in GitHub Desktop.
Save anthonygelibert/3cec372ef57f273aa1ceac671273c806 to your computer and use it in GitHub Desktop.
Add zero host entry to `/etc/host` from given URL
#!/bin/bash
cp /etc/hosts /etc/hosts.tmp
echo "# $1" >> /etc/hosts
echo "$1" | sed -r 's_https?://([^/]*)/.*_0.0.0.0 \1_' >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment