Re:The Beauty of Unix Pipelines
by philsnow on Friday June 05, 2020 @04:00AM
(#23426116)
elsewhere in this thread somebody mentions socat, but you can do it entirely within bash. from https://www.linuxjournal.com/content/more-using-bashs-built-... :
https://news.ycombinator.com/item?id=23422423 has a good point that "everything is a file" is maybe less useful than "everything is a file descriptor". the shell is a tool for setting up pipelines of processes and linking their file descriptors together.
[ Parent
| on HN ]
Daniel J. Bernstein's little known http@ tool is just a shell script wrapped around tcpclient, and is fairly similar, except that it does not use the Bashisms of course:
printf 'GET /%s HTTP/1.0\nHost: %s:%s\n\n' "${2-}" "${1-0}" "${3-80}" |
/usr/local/bin/tcpclient -RHl0 -- "${1-0}" "${3-80}" sh -c '
/usr/local/bin/addcr >&7
exec /usr/local/bin/delcr <&6
' |
awk '/^$/ { body=1; next } { if (body) print }'