[英]What is the difference between "#!/usr/bin/env bash" and "#!/usr/bin/bash"?
[英]What is the difference between “>” and “&>” in bash?
在 bash 中,我們有 3 種流類型:
因此,在執行某些程序時,我可以使用這些流(例如,我可以將它們從控制台重定向到文件或類似 /dev/null 等的文件):
# only errors from STDERR will be shown, STDOUT will be moved to /dev/null
command > /dev/null
# only STDOUT will be shown, STDERR will be moved to /dev/null
command 2> /dev/null
看到有人寫command &> /dev/null
bash 中>
和&>
什么區別?
bash 中的“>”和“&>”有什么區別?
這是一種重定向stdout
和stderr
的bashism。 它也可以通過更便攜的方式來實現:
command > file 2>&1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.