作者:777
# cat chlevel ----------------------------------------------------------- #!/bin/bash # change the run level at the boot time. #time :2003.8.5 grep id /etc/inittab echo "Are you want change the runlevel at the boot ? (y/n) " read num if [ $num = "y" ];then if [ -e /etc/inittab ] then echo "Input a number for runlevel at system boot:" read level if [[ $level = ^[0-9] || ${#level} > 1 ]] then echo "The number is wrong." else if [[ $level >0 && $level <6 ]] then cat /etc/inittab|sed 's/id:[12345]:in/id:'$level':in/'>h&&cat h>/etc/inittab rm -fr h&&chmod 644 /etc/inittab else echo "The number is wrong!" fi;fi else echo "File not found!" fi;else echo "The run level have not change!" fi grep id /etc/inittab |