如何刷新 diff 的输出
我有这样的脚本,
diff abc def
if [ "$?" -eq "0" ]; then
make modules_install
enif
How i can避免 diff 的输出
如果我执行 diff abc def 2 >/dev/null
然后仍然输出显示,
。有什么想法吗?
I have script something like this
diff abc def
if [ "$?" -eq "0" ]; then
make modules_install
enif
How i can avoid ouput of diff
if I do diff abc def 2 >/dev/null
then still ouput display.
Any idea ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须重定向 stdout 和 stderr。您可以使用以下命令:
如果您需要在文件相同时执行多于一件事,则 if 语句会更好:
注意:当命令的退出代码为 0 时,对于以下测试中的测试来说,它被视为 true壳。
You must redirect stdout and stderr. You can use the following:
If you need to do more than one thing when the files are the same, then the if statement would be better:
NOTE: When the exit code of the command is 0 it is seen as true for tests in the shell.