简体   繁体   English

使用cat命令时抑制错误消息

[英]Suppress Error message while using cat command

I have a script where I recursively copy the contents of the files in a folder using cat command as follows 我有一个脚本,我使用cat命令递归复制文件夹中文件的内容,如下所示

test -f /tmp/$F || cat $F > /tmp/$F

I get the following error 我收到以下错误

cat: read error: Invalid argument

I want to know how can I suppress this error. 我想知道如何抑制此错误。 I only have access to shell interpreter (no bash). 我只能访问shell解释器(没有bash)。

Thanks 谢谢

将错误消息发送到/dev/null

cat $F 1>/tmp/$F 2>/dev/null

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM