Created
August 29, 2014 18:03
-
-
Save jbdatko/d7fd5f4232db99f85e00 to your computer and use it in GitHub Desktop.
Script to change hostnames on debian systems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$#" -ne 1 ]]; then | |
echo "$0 usage: newhostname (run as root)" | |
exit 1 | |
fi | |
name=$(hostname) | |
hostname $1 | |
sed -i "s/$name/$1/" /etc/hosts | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment