| 12345678910111213141516171819202122232425 |
- #!/bin/bash
- # Licence : GPL v3
- # Author: Laurent HUBERT
- #
- # Changes the machine hostname
- #
- cat <<EOF
- ##############################
- # Changing hostname #
- ##############################
- EOF
- read -p "Please enter new hostname: " answer
- if [ -n "$answer" ]
- then
- echo Changing hostname to $answer
- current=$(hostname)
- sed -i.firstboot.backup s/$current/$answer/g /etc/hostname
- sed -i.firstboot.backup s/$current/$answer/g /etc/hosts
- hostname $answer
- exit 0
- else
- # Exit with non zero status
- exit 1
- fi
|