Hacker News new | ask | show | jobs
by chubot 32 days ago
I think that is basically the approach modernish uses: https://github.com/modernish/modernish

But it does feel complex to me.

Personally I just write in the common subset of bash and OSH, which is very large. I never need to support say dash, since every machine that has dash also has bash, which is less broken in terms of 'echo' and so forth.

bash has its own broken-ness, but running under OSH solves that.

And OSH also supports some busybox idioms -- we learned last year that bash cannot run busybox ash scripts on Alpine

e.g. 'chdir' is an alias for 'cd' in busybox, but not in bash. And Alpine scripts use it, so bash can't run Alpine scripts, but OSH can (as of last year).

1 comments

One of the reasons for using dash is speed. It's so fast, it allows people to write programs that were not viable before.

The pure shell C compiler is an example of that: https://gist.github.com/alganet/2b89c4368f8d23d033961d8a3deb...

It's portable among the most popular shells, but much faster on dash. It's obviously a gimmick, but also a way to stress the interpreters past their usual breaking points.

osh fails at it because of multi-command/block-level alias (I opened an issue with a simplified reproduction).

---

Options are good. Shell is amazing at that, lots of interpreters to serve all kinds of users and use cases.