Chinaunix首页 | 论坛 | 博客
  • 博客访问: 69067
  • 博文数量: 24
  • 博客积分: 50
  • 博客等级: 民兵
  • 技术积分: 135
  • 用 户 组: 普通用户
  • 注册时间: 2011-11-24 22:12
文章分类

全部博文(24)

文章存档

2013年(24)

我的朋友

分类: LINUX

2013-04-15 23:26:39

1. The exit command terminates a script. It can also return a value, which is available to the script's parent process.
2. $? reads the exit status of the last command executed. After a function returns, $? gives the exit status of the last command executed in the function. Following the execution of a pipe, a $? gives the exit status of the last command executed. After a script terminates, a $? from the command-line gives the exit status of the script, that is, the last command executed in the script.
3. The !, the logical not qualifier, reverses the outcome of a test or command, and this affects its exit status.

点击(此处)折叠或打开

  1. ! true # Note that the "!" needs a space between it and the command.
  2. echo "exit status of \"! true\" = $?" # 1


阅读(1764) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~