Skip to content

Instantly share code, notes, and snippets.

@eidantoei
Created July 6, 2012 09:54
Show Gist options
  • Save eidantoei/3059311 to your computer and use it in GitHub Desktop.
Save eidantoei/3059311 to your computer and use it in GitHub Desktop.
余計なhostsコメントアウトして帰るやつ
#!/bin/bash
BORDER="# -------- TEMPORARY_HOSTS --------"
L=$(( $(fgrep -n "${BORDER}" /etc/hosts | cut -d: -f1) + 1 ))
sudo sed -i.$(date +%F-%H-%M-%S) "${L},\$s/^\([^#]\)/#\1/g" /etc/hosts
cat /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment