我想使用 bash shell 压缩一个文件,所以我使用了:
echo -n 'Insert the file path:'
read path
echo 'Hello World' > ${path}
zip -u ${path}.zip ${path}
当我运行这个脚本时,它会给我一个警告:
zip warning: test.zip not found or empty
adding: test (deflated 66%)
它工作得很好,但我如何才能禁用此警告?我是否以正确的方式使用 zip
?
最佳答案
我想你想要安静的旗帜。
zip -uq ${path}.zip ${path}
来自手册页:
-q --quiet Quiet mode; eliminate informational messages and comment prompts. (Useful, for example, in shell scripts and background tasks).
关于linux - 如何在 bash 中禁用 'zip' 警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7706311/