- 论坛徽章:
- 0
|
本帖最后由 wuxiaobo_2009 于 2013-12-30 20:41 编辑
- # Evgeniy Ivanov points out:
- var=0
- echo $? # 0
- # As expected.
- let var++
- echo $? # 1
- # The command was successful, so why isn't $?=0 ???
- # Anomaly!
- [color=Red]# i want to known why ?[/color]
- let var++
- echo $? # 0
- # As expected.
- [color=Red]# i also want to known why ?[/color]
- # Likewise . . .
- let var=0
- echo $? # 1
- # The command was successful, so why isn't $?=0 ???
- # However, as Jeff Gorak points out,
- #+ this is part of the design spec for 'let' . . .
- # "If the last ARG evaluates to 0, let returns 1;
- # let returns 0 otherwise." ['help let']
复制代码 |
|