#!/bin/bash echo 'auto lo iface lo inet interface auto eth0' > /etc/network/interfaces echo "Enter the type IPaddress" read type echo "iface eth0 inet $type" >> /etc/network/interfaces if [ "$type" = static ] then echo "Enter the IP: " read ipaddr echo " address $ipaddr" >> /etc/network/interfaces echo "Enter the netmask: " read netmask echo " netmask $netmask" >> /etc/network/interfaces echo "Enter the gateway: " read gateway echo " gateway $gateway" >> /etc/network/interfaces echo "Enter the dns-nameservers: " read dns echo " dns-nameservers $dns" >> /etc/network/interfaces else echo "Setup IP success!!!" fi while true; do read -p "Do you wish to reboot device?(y/n)" yn case $yn in [Yy]* ) reboot; break;; [Nn]* ) exit;; * ) echo "Please answer yes or no.";; esac done exit 0