Hacker News new | ask | show | jobs
by jingo 4287 days ago
It is a (rare) pleasure to see a simple solution posted to HN that does not require Python or some other scripting language. Or GNU sed for that matter.

I no longer have a Blackboard account, but if I did, or had a guest account to play with, I would try rewriting your Bash script in POSIX-like sh.

Nice work and a good choice of project.

2 comments

It actually does require sed, and either python or openssl.

"Requirements

bash curl sed openssl or python"

"GNU sed" has "features" not always found in all other sed's elsewhere, outside of GNU/Linux.

You can substitute other tcp clients for curl.

And the openssl binary is ubiquitous, so he is smart to use it for generating base64 versus other userland utilities for generating base64 that are not always found outside of GNU/Linux.

Yes, the bash script could be made more portable. Also there are some GNU-specific sed features used, but I'm sure that could be changed to be more portable as well. Python or openssl is used for some base64 encoding.

I like using shell scripts for projects like this because of the power of piping commands/functions and doing line-based processing with e.g. sed.