Hacker News new | past | comments | ask | show | jobs | submit login

/bin/sh?

I am not sure what the balance of facetious vs serious is here. The various Unix shells have been stable for quite a while. Obviously sh is very barebones, but zsh and bash, for example, have associative arrays and other modern conveniences.

Outside of various shells, there are several other options that come to mind which do not teeter on facetiousness.

So far as I know, tcl is also quite stable.

Common Lisp is perfectly usable as a scripting language and has a very stable standard and mature libraries.




The reason I reach for Perl rather than bash is it has far more features and far easier to manage.

I don’t bother with python as you get into a horrendous mess with pip breaking and the v2/v3 issue.

Not every piece of code needs to serve a million people, not every piece of code needs to be sold to google, sometimes you just need code to do a simple occasional job and not change every couple of years.


The Python v2/v3 "issue" has been a non-issue for years now. If you're writing code to do a simple occasional job, Python is perfectly suited to that.


So is perl, and tcl and shell and JavaScript and PHP. For a "simple occasional job" the right tool is the one you know best (or the organization knows best).


Python is fully on v3 now. It was a terrible transition, but it's done.


Hahaha no. Much of our code is still v2, with no hint of a transition happening any time soon. It's mostly in maintenance mode.

Quick edit: To sibling comment's point, we're not a tech company, so it's very difficult to get this type of work done. It pretty much only happens on new development (where we are using python3), but that new development doesn't replace the old code.


Python 2 just reached end-of-life with the last-ever update arriving in October this year. So you better get moving soon if your code isn't completely air gapped.

https://adtmag.com/articles/2020/01/09/python-2-end-of-life....

There are current three outstanding CVEs for the latest version of Python 2. Hopefully, they'll be patched up in the upcoming release, but good luck after that.

https://www.cvedetails.com/vulnerability-list/vendor_id-1021...


This is true some places, but it's not true everywhere. It's just that the places stuck on Python 2 often have other disconnects that make them "invisible" on the Internet.


Quick search to do something on the web and there’s a strong chance it will be python2.

Pip install? Or pip3 install? Who knows, whatever you do don’t follow the instructions s to upgrade pip as that breaks Debian and Ubuntu installs. Cpan was always a bit ropey but never this bad.


Not having any practical need for a “Perl version manager” as other languages have (shit, it’s even useful with Go) is an underrated benefit of choosing a language as stable as Perl. Version? What is your distro 30 years old? Just run it!


I've written many shell scripts.

Trust me, /bin/sh is not a stable, non-moving target. Not even on GNU/Linux. Go further afield and there are a great many quirks.

Even on Linux I've encounted four major flavours of /bin/sh: Dash, Bash, Ash and Msh.

The available variable interpolation syntaxes vary considerably. The only portable way to do most string things tend to use combinations of 'echo' or 'printf' and 'sed', and even those aren't portable without some platform detection. Something as simple as adding the right number of backslashes to a command, for example to quote a command given to SSH, is tricky in shell and quite version dependent.

Bash isn't a non-moving target either; I've had Bash scripts break when moved from one Linux distro to another, due solely to different behaviours of different Bash versions.

Some of the things Autoconf does to workaround /bin/sh differences are quite exciting.

If you consider /bin/sh scripting to include the behaviour of commands run from it, which you probably should, the situation is much worse. Very standard things like 'ls', 'echo', 'cp' vary across platforms in meaningful ways.

In comparison, Perl is much more consistent across platforms and versions. If it does something in one version on any platform, it almost always does exactly the same in any later version on every platform.


You make a really good argument. Especially the external binaries part convinces me that shell is much more on the facetious end of that response spectrum.

I would argue that it is unfair to compare different implementations of shell, though. I think it's fair to compare across versions of bash, for example, but disingenuous to compare, e.g., Dash, Bash, Ash, and Msh. If, for example, Dash is my target, then I should call and install Dash. For this reason, it was probably a poor idea for me to call out /bin/sh, specifically, as custom dictates that this is, in fact, a different program in different environments.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: