LinuxSir.cn,穿越时空的Linuxsir!

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

新手看linux的启动脚本,有几句不明白,帮忙看看

[复制链接]
发表于 2006-8-16 10:21:31 | 显示全部楼层 |阅读模式
if [ -f /etc/sysconfig/desktop ]; then
  . /etc/sysconfig/desktop             //. 后面有个空格,这句是什么意思啊

if [ -n "$PREFERRED" ] && which $PREFERRED >/dev/null 2>&1;then
  PREFERRED='which $PREFERRED'     //which在这里有什么用呢
  exec $PREFERRED    工艺    //直接exec startkde 不行吗

while [ x"$1" != x]; do    //这句又不明白了,x是干吗用的,整句又是什么意思呢
发表于 2006-8-16 11:35:10 | 显示全部楼层
well... you really need to learn some basic shell programming knowledge. Please read the top threads in the forum and also the well-known abs book. All your questions are in those places.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-8-16 12:51:28 | 显示全部楼层
我也知道应该找本书好好从头开始看起.但现在急用,来不急这么仔细的看
希望各位能不嫌问题过分简单,给我个解答吧
回复 支持 反对

使用道具 举报

发表于 2006-8-16 13:14:59 | 显示全部楼层
haha.. ok. promise me you will read the doc, ok.
1. '.' with a space means source the file. All the params and funcs defined in the target script will be sourced into the current running shell.
2. which is a program to find the absolute path of another program. say 'which ls' will show '/bin/ls'. Its much safer to use absolute path when referencing to a program.
3. [ x"$1" = x ] is a technic to verify if $1 is an empty string or not. It is only true when $1 is empty, not even $1 = " " (a single space. you don't see it but its not empty now.) ..
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-8-16 13:48:27 | 显示全部楼层
谢谢版主,正在看<<Learning the bash shell>>
1.变量和函数引进后是不是说当前脚本就可以完全使用它们?
2.&& which $PREFERRED >/dev/null 2>&1;这个条件测试有什么作用呢?我的理解是它把所有输出都重定向到/dev/null了.
3.明白了
回复 支持 反对

使用道具 举报

发表于 2006-8-16 14:41:08 | 显示全部楼层
1. yes.
2. make sure there is a such program there and the test doesn't need to output the content of 'which $PREFERRED'.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-8-16 14:48:50 | 显示全部楼层
呵,明白了,多谢!!
可否问一下,版主怎么总是用英文回答
回复 支持 反对

使用道具 举报

发表于 2006-8-16 15:04:52 | 显示全部楼层
no Chinese configured in my laptop which is from my company...
回复 支持 反对

使用道具 举报

发表于 2006-8-17 15:24:51 | 显示全部楼层
it's so funny
回复 支持 反对

使用道具 举报

发表于 2006-8-17 23:27:12 | 显示全部楼层
怎么回帖子的说的是英文?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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