Chinaunix首页 | 论坛 | 博客
  • 博客访问: 18681509
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类:

2008-05-03 10:42:24

作者: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
阅读(1471) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~