由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - [转载] qestion about grep
相关主题
[转载] 再请教高手关于cxterm的问题
a puzzle!!Re: how to change all the files .cpp to .C
how to escape both ' and " from tcsh?[转载] About the history
how to grep with more than one patterns in tcsh?如何单步执行shell?
questionwhich shell is best?
[转载] Shell高手看过来。how to let awk not print?
向高人请教:怎么从大量的文件中grepequivilent $REMOTEHOST in ksh
how to run background process after logoutshell programming问题:如何同时run多个作业
相关话题的讨论汇总
话题: grep话题: qestion话题: about话题: tcsh话题: 有错
进入Unix版参与讨论
1 (共1页)
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,
: 执行完了有改成有错就退出。

1 (共1页)
进入Unix版参与讨论
相关主题
shell programming问题:如何同时run多个作业question
Change shell to tcsh?[转载] Shell高手看过来。
.cshrc?.login?.profile?向高人请教:怎么从大量的文件中grep
bash 彩色 shell prompthow to run background process after logout
[转载] 再请教高手关于cxterm的问题
a puzzle!!Re: how to change all the files .cpp to .C
how to escape both ' and " from tcsh?[转载] About the history
how to grep with more than one patterns in tcsh?如何单步执行shell?
相关话题的讨论汇总
话题: grep话题: qestion话题: about话题: tcsh话题: 有错