-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC3025
Joachim Ansorg edited this page Nov 12, 2021
·
2 revisions
(or "In dash, ... is not supported." when using dash
)
echo foo > /dev/tcp/myhost/1234
Rewrite using a tool like netcat (nc
):
echo foo | nc myhost 1234
/dev/tcp/$host/$port
and /dev/udp/$host/$port
are recognized in redirections by bash and ksh, and a socket connection is made instead of opening a file. They do not physically exist in /dev
.
POSIX sh and dash do not support this, so any such code should be rewritten to use a socket tool explicitly. The obvious candidate is netcat aka nc
.
None
- Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!