<<EOF怎么用?
我直接给出一个例子, 一看应该就明白了
(base) ➜ Byterun git:(master) ✗ <<EOF
heredoc> JUST
heredoc> FOR
heredoc> FUN
heredoc> EOF
JUST
FOR
FUN我认为 <<EOF 最重要的使用方式就是能帮助我们一次输入多行的内容.
:::tip EOF可以替换成其他字符, 当然有些字符比如<是不能用的
<<TT
...
TT:::
这个东西单独使用没什么价值, 但是结合其他命令一起使用就可以发挥一些作用了.
譬如我们想在 .zshrc里添加两个变量
(base) ➜ ~ tee >> .zshrc <<EOF && source .zshrc
cmdand heredoc> export JJJ="test"
cmdand heredoc> export TTT="fun"
cmdand heredoc> EOF
(base) ➜ ~ tail -n 2 .zshrc
export JJJ="test"
export TTT="fun"
(base) ➜ ~ echo $JJJ && echo $TTT
test
fun