Discussion:
[Help-bash] native support for CRLF in heredoc
Peng Yu
2018-02-09 14:21:00 UTC
Permalink
Hi,

I use `sed` to support CRLF in heredoc.

sed 's/$/\r/g' <<EOF | nc -v httpbin.org 80
GET /get HTTP/1.1
Host:httpbin.org

EOF

Ideally, I would like something simpler (of course the following does
not work as expected).

nc -v httpbin.org 80
GET /get HTTP/1.1
Host:httpbin.org

EOF

Does anybody know anything more native to bash that support CRLF in
heredoc? Thanks.
--
Regards,
Peng
Eduardo A. Bustamante López
2018-02-09 14:35:24 UTC
Permalink
Post by Peng Yu
Hi,
I use `sed` to support CRLF in heredoc.
sed 's/$/\r/g' <<EOF | nc -v httpbin.org 80
GET /get HTTP/1.1
Host:httpbin.org
EOF
Ideally, I would like something simpler (of course the following does
not work as expected).
[...]

What's wrong with the 'sed' version? I think that's the simplest you'll get.
Loading...