#!/bin/bash
02.echo "New system configuration" 03.sleep 1 04.echo "Environment RHEL6.3" 05.sleep 1 06.echo "The kernel version configuration!" 07.sleep 1 08.echo "Designed by www.rsyslog.org http://dreamfire.blog.51cto.com" 09.sleep 1 10.input_fun() //定义一个可以重复输入的函数(空值回车情况下 也可用参考http://dreamfire.blog.51cto.com/418026/1152672)11.{ 12. OUTPUT_VAR=$1 13. INPUT_VAR="" 14. while [ -z $INPUT_VAR ];do 15. read -p "$OUTPUT_VAR" INPUT_VAR 16. done 17. echo $INPUT_VAR 18.} 19. 20.input_again() //定义网络参数函数,交互式读取输入.21.{ 22.MYHOSTNAME=$( input_fun "Please input the hostname: ") 23.DOMAINNAME=$( input_fun "Please intput the domainname(rsyslog.org): ") 24.CARD_TYPE=$( input_fun "Please input card type(eth0): ") 25.IPADDR=$( input_fun "Please input ipaddress(192.168.100.1): ") 26.NETMASK=$( input_fun "Please input netmask(255.255.255.0): ") 27.GATEWAY=$( input_fun "Please input gateway(192.168.100.1): ") 28.MYDNS1=$( input_fun "Please input DNS1(192.168.100.102): ") 29.MYDNS2=$( input_fun "Please input DNS2(192.168.100.103): ")