Multiline syntax for piping a heredoc; is this portable?

前端 未结 4 1509
北恋
北恋 2020-12-12 14:54

I\'m familiar with this syntax:

cmd1 << EOF | cmd2
text
EOF

but just discovered that bash allows me to write:

cmd1 &         


        
4条回答
  •  执笔经年
    2020-12-12 15:09

    Hmm, I suppose yes, according to the test in bash in POSIX mode:

    $ bash --posix
    $ cat < ahoj
    > nazdar
    > EOF
    > sed 's/a/b/'
    bhoj
    nbzdar
    

提交回复
热议问题