3 ms·
I've been wanting to write modules to bring more of Plan 9 to Linux by exposing character devices in /dev for TCP (and probably other things, but that's the big
by yjftsjthsd-h 5y ago
I've been wanting to write modules to bring more of Plan 9 to Linux by exposing character devices in /dev for TCP (and probably other things, but that's the big one).
- kbenson 5y agoOne of the reasons this probably hasn't already happened is because bash specially handles those so they work already. From the man page for bash: Bash handles several filenames specially when they are used in redirections, as described in the following table: /dev/fd/fd If fd is a valid integer, file descriptor fd is duplicated. /dev/stdin File descriptor 0 is duplicated. /dev/stdout File descriptor 1 is duplicated. /dev/stderr File descriptor 2 is duplicated. /dev/tcp/host/port If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open a TCP connection to the corresponding socket. /dev/udp/host/port If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open a UDP connection to the corresponding socket. Edit: Not to imply it's not a good idea. I think it is, so much so that the only reason it wasn't done long ago is because often a "good enough for most people" solution can sap the need for a different solution which has other benefits.
- yjftsjthsd-h 5y agoI'm aware, but I want that functionality outside of BASH.