小编Zhe*_*kai的帖子

exec 3<&1 有什么作用?

我知道exec可以在当前 shell 上进行 I/O 重定向,但我只看到如下用法:

exec 6<&0   # Link file descriptor #6 with stdin.
            # Saves stdin.

exec 6>&1   # Link file descriptor #6 with stdout.
            # Saves stdout.
Run Code Online (Sandbox Code Playgroud)

据我了解,这<是用于输入流,>用于输出流。那么有什么作用exec 3<&1呢?

PS:我从Bats 源代码中找到了这个

shell bash io-redirection file-descriptors exec

15
推荐指数
1
解决办法
2万
查看次数

标签 统计

bash ×1

exec ×1

file-descriptors ×1

io-redirection ×1

shell ×1