使用cat命令时禁止显示错误消息 [英] Suppress Error message while using cat command
本文介绍了使用cat命令时禁止显示错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个脚本,其中我使用cat命令按如下方式递归复制文件夹中文件的内容
I have a script where I recursively copy the contents of the files in a folder using cat command as follows
test -f /tmp/$F || cat $F > /tmp/$F
我遇到以下错误
cat: read error: Invalid argument
I想知道如何抑制此错误。我只能访问shell解释器(没有bash)。
I want to know how can I suppress this error. I only have access to shell interpreter (no bash).
谢谢
推荐答案
将错误消息发送到 / dev / null
。
cat $F 1>/tmp/$F 2>/dev/null
这篇关于使用cat命令时禁止显示错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文