bash - 这些重定向在 Bash 中的含义是什么:“8>&1”、“9>&2”和“1>&9”?
问题描述
我之前2>&1
在 Bash 中遇到过语法,从这个问题中我了解到这意味着将 stderr 的输出重定向到 stdout。但是,我也遇到了标题中的语法,在 StackOverflow 或 Google 上找不到任何关于它们的含义。
它们出现在GitHub 上的这个 Bash 完成脚本中,特别是这个函数:
# Run something, muting output or redirecting it to the debug stream
# depending on the value of _ARC_DEBUG.
__python_argcomplete_run() {
if [[ -z "$_ARC_DEBUG" ]]; then
"$@" 8>&1 9>&2 1>/dev/null 2>&1
else
"$@" 8>&1 9>&2 1>&9 2>&1
fi
}
我确信该评论是一个线索,但我不知道 Bash 流有“8”和“9”。我只知道 0 作为标准输入,1 作为标准输出,2 作为标准错误。8 和 9 在 Bash 中是什么意思,这些重定向是什么意思?
解决方案
推荐阅读
- pandas - 从数据透视表中绘制多个单独的图表
- pandas - 有没有更简单的方法来改变颜色而不是使用 lambda?
- java - 如何将值映射到 Java 中的嵌套 Avro Schema
- flutter - 如何在颤动中更改表情符号文本的颜色
- three.js - 将 OrbitControls 定位到 3D 对象位置,避免将其放置到屏幕中心
- xml - Tableau 读取用于数据库身份验证的 xml 配置文件
- python - Pandas 通过使用 for 循环、编辑、然后组合进行分组
- php - 从 php-graph-sdk 迁移到 oauth2-facebook 库以使用移动应用程序登录 Facebook 的问题
- javascript - unhandledrejection 事件不包含原因字段是什么意思?
- rust - Rust 生命周期问题