4 ms·
This would let you implement the UNIX "everything is a file" philosophy on windows. Although I feel guilty because that's probably more the Plan 9 philosophy.
by t43562 3y ago
This would let you implement the UNIX "everything is a file" philosophy on windows.
Although I feel guilty because that's probably more the Plan 9 philosophy. On Linux you get a lot of nice things by having /procfs for example but lots of things aren't files that might be. I've often wondered if a file based interface to dbus wouldn't be very liberating from the scripting point of view for example.
Plan 9 even does sockets via a file based interface and to my eyes it's no more clunky than BSD sockets - but presto, any bash script would be able to open a socket without netcat.
- bytK7 3y agoIndeed, bash already has socket access via /dev/tcp/HOST/PORT and /dev/udp/HOST/PORT, which allow opening a socket and reading from/writing to it as if it were an ordinary file.
- folmar 3y agoThough this is implemented in bash itself and only works in bash, not in other programs.
- meinheld111 3y agoThe number of unix environments w/o bash available is surprisingly small thou
- proaralyst 3y agoIt means you can't just call open('/dev/tcp/blah') from a program and get a TCP socket though, unfortunately
- ithkuil 3y agoIIRC that only works for clients and can't be used for listening. Also IIRC there is a bash loadable module that implements server sockets but that can't be relied upon if you're just shipping bash scripts meant to be run without the end user preparing the ground before running it.
- hughesjj 3y agoI mean, file handlers exist in Linux. That would be so cool if you could add a file/directory watch to an http endpoint/resource