Hacker News new | ask | show | jobs
by 1amzave 4083 days ago
Arguably not pure bash, in that it calls out to external executables. I'm pretty sure all the head/cut/tr invocations could be easily replaced by appropriate parameter expansions though, and the `read` builtin could probably supplant `dd`, so it should be doable.
1 comments

Bash doesn't exist in a vacuum. It's designed to make use of and interact heavily with those external commands. An environment missing dd, head, cut, and tr is probably not going to provide a usable /dev/tcp filesystem, either.

Ultimately the point is that a Redis client is possible using just a standard Unixish userland, and sysadmins who interact with Bash all day can easily make use of redis directly and integrate it into existing scripts without installing special client libraries or writing wrappers in Perl or Python.

Sure -- but my point was merely in regard to the (mis)use of the word "pure" here. Avoiding calling out to external executables and remaining purely within the shell itself is also frequently a good way to improve performance (sometimes quite dramatically), so being aware of the difference is worthwhile.

(Also, /dev/tcp isn't a filesystem, just a simulation of one constructed purely within bash itself, so it wouldn't in fact depend on anything but the relevant networking syscalls.)