Suppress Error message while using cat command

谁说我不能喝 提交于 2019-12-12 12:04:45

问题


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

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).

Thanks


回答1:


Send error messages to /dev/null.

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


来源:https://stackoverflow.com/questions/27178935/suppress-error-message-while-using-cat-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!