专注各种脚本编程
Baidu
加入收藏夹
本站内容有下面分类知识,欢迎您的到来^_^
shell相关:指令篇 基础篇 脚本欣赏 编程实例 shell问问 shell视频教程 技巧篇 水平测试 E文资料 vi编辑器 高级Bash脚本编程指南
其他:mysql perl c语言 oracle
当前位置:| 主页>shell脚本欣赏>

改变系统启动运行等级的shell脚本

百度收藏 QQ搜藏

作者: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

上一篇:一个查找字符的shell脚本 下一篇:基于图形界面的改变系统启动运行等级shell脚本

power by soyo123 2007-2008