12 ms·
no mention of /dev/tcp?! yes, it looks like a device node in /dev, but it's really a pure bashism for opening tcp connections to arbitrary hosts and ports
by heuxbzjnz 7y ago
no mention of /dev/tcp?!
yes, it looks like a device node in /dev, but it's really a pure bashism for opening tcp connections to arbitrary hosts and ports
- unixhero 7y agoWhoa... News to me! Thanks.
- dyanaraps 7y agoI've been meaning to get around to it. I hadn't messed around with /dev/tcp prior to writing this bible. I've since implemented a very bare-bones and very featureless IRC client using /dev/tcp and bash. https://github.com/dylanaraps/birch https://github.com/dylanaraps/birch I will get around to it eventually. The one hurdle I want to get over before writing a piece about it is the handling of binary data using bash. This is something a little tricky to do with bash but it'd allow for a 'wget'/'curl' like program without the use of anything external to the shell (no HTTPS of course). I want to really understand the feature before I write about it though in the meantime I could just write a reference to the syntax/basic usage. :)
- anaphor 7y agohttps://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip https://www.linuxjournal.com/content/more-using-bashs-built-... has a decent explanation. I came here to say the exact same thing. This is my favourite thing most people don't know exists in Bash.
- dredmorbius 7y agoKeep in mind that major distros (Debian, possibly derivatives) disabled tcp/udp service names in 2000: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=65172 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=65172