Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2044717
  • 博文数量: 470
  • 博客积分: 10206
  • 博客等级: 上将
  • 技术积分: 5620
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-03 12:50
文章分类

全部博文(470)

文章存档

2012年(1)

2011年(18)

2010年(47)

2009年(404)

分类:

2009-09-28 18:58:55

[] [] [] [] []
  帅哥
光明使者




CU编号: 690903
注册:2008-4-13
最后登录: 2009-09-28
帖子:
精华:0







状态:...在线...

[] [] [博客]


[]       顶部
发表于 2009-9-28 15:00 

#!/bin/bash -e 其中的-e 是什么意思?



您对本贴的看法:
| | |

光明使者




CU编号: 458302
注册:2006-8-25
最后登录: 2009-09-28
帖子:
精华:0







状态:...离线...

[] [] [博客]


[]     顶部
发表于 2009-9-28 15:10 

-e ENAME selects which editor to use.  Default is FCEDIT, then EDITOR, then vi.



您对本贴的看法:
| | |
版主   帅哥 (孩儿他爹㊞)
广告杀手-老法王



CU编号: 17255
注册:2002-8-26
最后登录: 2009-09-28
帖子:
精华:







来自:中国南京
状态:...在线...

[] [] [博客]


[]     顶部
发表于 2009-9-28 15:11 

#!/bin/bash -e
while :
do
false
done


#!/bin/bash
while :
do
false
done

对比一下



您对本贴的看法:

__________________________________

=GNU/linux=
GNU {bash 2.05b, grep 2.5, Awk 3.1.3, sed 4.0.8}

导师说:站起来吧
众人说:那么辛苦那么艰苦到底值不值?

设计师说:富起来吧
众人说:拼啦

| | |
  帅哥
光明使者




CU编号: 551382
注册:2007-4-13
最后登录: 2009-09-28
帖子:
精华:0







状态:...离线...

[] [] [博客]


[]     顶部
发表于 2009-9-28 15:18 

-e      Exit  immediately  if a simple command (see SHELL GRAMMAR above) exits with a non-zero
           status.  The shell does not exit if the command that fails is part of the command list
           immediately  following  a while or until keyword, part of the test in an if statement,
           part of a && or || list, or if the command's return value is being inverted via !.   A
           trap on ERR, if set, is executed before the shell exits.



您对本贴的看法:
| | |
(Lemon)
精灵使


CU奥运火炬传递手2008
CU编号: 615557
注册:2007-9-11
最后登录: 2009-09-28
帖子:
精华:0







状态:...离线...

[] [] [博客]


[]     顶部
发表于 2009-9-28 15:19 

脚本发生第一个错误时就中止脚本运行



您对本贴的看法:
| | |
  帅哥
光明使者




CU编号: 690903
注册:2008-4-13
最后登录: 2009-09-28
帖子:
精华:0







状态:...在线...

[] [] [博客]


[]       顶部
发表于 2009-9-28 15:42 

回复 #3 waker 的帖子

谢谢waker斑斑!  
明白了!
[jesse@localhost shell_scri]$ ./bash_e.sh
[jesse@localhost shell_scri]$ echo $?
1
[jesse@localhost shell_scri]$ ./bash.sh




^C
[jesse@localhost shell_scri]$ cat bash_e.sh
#!/bin/bash -e
while :
do
false
done
[jesse@localhost shell_scri]$ cat bash.sh
#!/bin/bash
while :
do
false
done



您对本贴的看法:
| | |
  帅哥
光明使者




CU编号: 690903
注册:2008-4-13
最后登录: 2009-09-28
帖子:
精华:0







状态:...在线...

[] [] [博客]


[]       顶部
发表于 2009-9-28 15:43 

也谢谢2楼4楼5楼的兄弟们! 谢谢!



您对本贴的看法:
| | |
阅读(2243) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~