Hacker News new | ask | show | jobs
by chubot 2671 days ago
I agree bash is not a sane production language, and apparently so does Greg Wooledge, somebody who has maintained a popular bash FAQ for a very long time. I quoted him in my latest release announcment:

OSH 0.6.pre15 Does Not Crave Chaos and Destruction http://www.oilshell.org/blog/2019/02/18.html

I did hear about Cloud Foundry moving from shell to Go for some things, and I also heard that Kubernetes was rewriting a lot of its shell. [1]

(1) If you had to choose between Go and bash, I can understand choosing Go. I saw some blog posts along those lines [2].

Although I don't think it's optimal. I'd be interested in seeing some of those "shell scripts in Go" if you have a link. There should be a better language for sane shell scripting (hence Oil).

(2) I imagine it's not fun to port thousands of lines of shell to Go (or Ruby) by hand. Oil is supposed to help with that via an approximate translation and good errors, but that part isn't done yet.

What IS close to done is a dialect of bash that is sane -- or CAN BE MADE sane with user feedback.

For example, in the latest release I added set -o strict-argv, and there's also set -o strict-control-flow and strict-word-eval. I will add a strict-ALL to opt into all at once, as mentioned in the release notes.

Also, OSH gives you all your parse errors at once, rather than having them blow up at runtime later:

How to Parse Shell Like a Programming Language http://www.oilshell.org/blog/2019/02/07.html

[1] I just pulled the Kubernetes and there's 44K lines in *.sh files, as opposed to 48K lines a couple years ago. If it were proportional to the project's growth, I would have expected it to be 100K lines by now, so it seems they are indeed getting rid of shell!

However this only removes ONE LAYER of shell. Any cloud service that uses a Linux distro (which is all of them) is papering over all the nasty layers of shell underneath! I hope that Linux distros will gradually move to Oil to get rid of this legacy.

[2] https://jvns.ca/blog/2017/07/30/a-couple-useful-ideas-from-g...