c**e 发帖数: 3760 | 1 【 以下文字转载自 Programming 讨论区 】
【 原文由 cure 所发表 】
grep 如果找不到匹配,就return 1 which is considered error.
我的tcsh script又希望能用-e option (一有错就exit),
但是就因为grep的缘故不能用,否则grep不到匹配就退出了。
有没有办法解决这个问题,比如执行grep之前ignore errors,
执行完了有改成有错就退出。 | c*****t 发帖数: 1879 | 2 easy, do something like:
if ( `grep ....` ) then
endif
ps, tcsh is not supposed to be used in shell programming. Use
standard shell instead.
【在 c**e 的大作中提到】 : 【 以下文字转载自 Programming 讨论区 】 : 【 原文由 cure 所发表 】 : grep 如果找不到匹配,就return 1 which is considered error. : 我的tcsh script又希望能用-e option (一有错就exit), : 但是就因为grep的缘故不能用,否则grep不到匹配就退出了。 : 有没有办法解决这个问题,比如执行grep之前ignore errors, : 执行完了有改成有错就退出。
|
|