LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1767|回复: 4

请教一段perl小程序?

[复制链接]
发表于 2003-7-9 16:51:09 | 显示全部楼层 |阅读模式
opendir MODDIR, "/lib/modules/2.4.20/kernel/drivers/sound/";
while($mod = readdir MODDIR){
  next if $mod =~ /^\.{1,2}$/;
  $mod =~ s/\.o$//;
  system "modprobe $mod > /dev/null 2>&1";
  last if -e "/dev/sound/dsp";
  system "rmmod $mod > /dev/null 2>&1";
}
closedir MODDIR;

据介绍是在加载audio card的驱动模块,,
哪位能详细解释一下,越细致越好,最好能让我外婆也听的懂
发表于 2003-7-9 17:16:07 | 显示全部楼层
SORRY~~~
我看还是让LY00兄给你解释吧!
 楼主| 发表于 2003-7-9 19:35:10 | 显示全部楼层
LY00兄???
发表于 2003-7-9 21:27:33 | 显示全部楼层
opendir MODDIR, "/lib/modules/2.4.20/kernel/drivers/sound/";##打开目录句柄;
while($mod = readdir MODDIR){##对目录下的文件进行操作
next if $mod =~ /^\.{1,2}$/;##过滤掉.和..目录文件;
$mod =~ s/\.o$//;##如果遇到.o文件;
system "modprobe $mod > /dev/null 2>&1";##就使用modprobe加载该模块;
last if -e "/dev/sound/dsp";##如果dsp存在的话就跳出当前循环;
system "rmmod $mod > /dev/null 2>&1";##如果dsp不存在的话就删除已加载的模块
}
closedir MODDIR;##关闭目录句柄
 楼主| 发表于 2003-7-10 13:22:10 | 显示全部楼层
谢谢lyoo,,以后有问题继续请教
看了你的homepage(http://www.linuxfire.com/~lyoo)
nice!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表