英文:
lz4 redirect output to /dev/null
问题
以下是您要翻译的内容:
I have the following command in my bash script and want to redirect the output to /dev/null but it is not working. What is the right way to achieve this?
tar cvf - -C / $SOURCE_DIR | lz4 --best - $ARCHIVE > /dev/null
Edit:
Example output (I'm creating an archive of the /home/philip/test
folder):
home/philip/test/
home/philip/test/test.txt
I want the above output to be redirected to //dev/null.
--$SOURCE_DIR is the folder I'm archiving. Ex: home/philip/test
--$ARCHIVE is the destination path where the archive is saved. Ex: /home/philip/temp.tar.lz4
英文:
I have the following command in my bash script and want to redirect the output to /dev/null but it is not working. What is the right way to achieve this?
tar cvf - -C / $SOURCE_DIR | lz4 --best - $ARCHIVE > /dev/null
Edit:
Example output (I'm creating an archive of the /home/philip/test
folder):
home/philip/test/
home/philip/test/test.txt
I want the above output to be redirected to /dev/null.
--$SOURCE_DIR is the folder I'm archiving. Ex: home/philip/test
--$ARCHIVE is the destination path where the archive is saved. Ex: /home/philip/temp.tar.lz4
答案1
得分: 1
Both commands might also errput messages when a problem occurs, so I don't recommend muting their stderr completely; I would just rework the command line in a way that limits their stderr to warnings/errors only:
tar cf - "$SOURCE_DIR" | lz4 -9 - > "$ARCHIVE"
英文:
Both commands might also errput messages when a problem occurs, so I don't recommend muting their stderr completely; I would just rework the command line in a way that limits their stderr to warnings/errors only:
tar cf - "$SOURCE_DIR" | lz4 -9 - > "$ARCHIVE"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论