4 ms·
Indeed, 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
by bytK7 3y ago
Indeed, 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