Chinaunix

标题: About let command.... [打印本页]

作者: dozec    时间: 2007-01-31 16:53
标题: About let command....
[nie@hellokitty ~]$ let $((count=1))
[nie@hellokitty ~]$ echo $?
0
[nie@hellokitty ~]$ let $((count=0))
[nie@hellokitty ~]$ echo $?
1



who can explain it?
Thanks.
作者: 寂寞烈火    时间: 2007-01-31 17:02
http://bbs.chinaunix.net/viewthr ... p;extra=&page=7
作者: 一梦如是    时间: 2007-01-31 17:20
       let arg [arg ...]
              Each arg is an arithmetic expression to be evaluated (see ARITH-
              METIC  EVALUATION).  If the last arg evaluates to 0, let returns
              1; 0 is returned otherwise.

$((count=0))会被shell变量替换成什么,可以echo出来看




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2