相关疑难解决方法(0)

用于管道heredoc的多行语法; 这便携式吗?

我熟悉这种语法:

cmd1 << EOF | cmd2
text
EOF
Run Code Online (Sandbox Code Playgroud)

但刚刚发现bash允许我写:

cmd1 << EOF |
text
EOF
cmd2
Run Code Online (Sandbox Code Playgroud)

(heredoc用作cmd1的输入,cmd1的输出用于cmd2).这似乎是一个非常奇怪的语法.它是便携式的吗?

bash shell pipe heredoc sh

122
推荐指数
4
解决办法
3万
查看次数

标签 统计

bash ×1

heredoc ×1

pipe ×1

sh ×1

shell ×1