在此处文档中使用文件描述符

Using file descriptor with here document

我想将此处的文档打开到编号为 3 的文件描述符中。稍后我将其复制到 cat 命令的标准输入中。但这不起作用。见下文

#!/bin/bash

cat 3<<222889 
I am reading
a string into 
file descriptor 3 which is copied to standrad input
222889
0<&3

将两个重定向器放在同一行:

cat 3<<222889 0<&3
I am reading
a string into 
file descriptor 3 which is copied to standrad input
222889

然后cat直接输出此处文档中的所有内容,简单。