3 ms·
Yes. Also accessible as a file, since everything is a file. echo "foo" > /dev/tcp/host/port
by 29athrowaway 7y ago
Yes.
Also accessible as a file, since everything is a file.
echo "foo" > /dev/tcp/host/port
- zokier 7y ago/dev/tcp is ugly hack in bash, not something provided by kernel. nc is arguably the more canonical way of doing networking in shell.
- anthk 7y agoIf you have nc you just need to reimplement echo.c and the task is over, as you can fetch busybox in several ways. Heck, a simple while loop over stdin would be enough. From the K&R book: #include <stdio.h> int main(){ int c; while((c =getchar()) != EOF){ putchar(c); } } Or just run nc from a < redirect, but, the shell could restrict that maybe.