&是什么QUOT;<<<"意味着bash命令行上?而它在哪儿记录?
问题描述:
这是什么<<<
在此命令行的意思
What does <<<
mean in this command line?
bc <<< "1 + 1"
这似乎并不组合&LT;
和&LT;&LT;
,我可以'找不到它的文档。这似乎表现就像
It doesn't seem to a combination of <
and <<
, and I can't find documentation for it. It seems to behave just like
echo "1 + 1" | bc
另外在 KSH
的作品,但不是在 SH
。
答
它引入了一个字符串,在这里,在附近的输入和输出重定向的部分的结尾记录。一个here字符串就是一个字在这里的文件:
It introduces a here string, documented near the end of the section on input and output redirections. A here string is just a one-word here document:
bc <<< "1 + 1"
等同于
bc <<EOF
1 + 1
EOF