News for hackers. Stuff that matters.
Re:Unix Shell Programming: The Next 50 Years [pdf] by pengaru on Friday June 04, 2021 @02:06PM (#27396776)
The problem is we've historically limited ourselves to the lowest common denominator shell so our scripts worked everywhere without modifications.

Hence everything has been stuck with the archaic limitations and oversights of posix shell or gnu bash as linux distros took over and largely standardized on it.

There have been numerous alternative shells and some significantly improve on the situation, unfortunately they've been largely ignored. Default shell choice has proven very sticky.

I do agree that it's practically impossible to write robust and safe scripts in bash/posix shell. You have to jump through many hoops if arbitrary user input is being handled. Frankly nobody should be writing generalized tools using such shells today, unless they have a very good reason to self-impose the constraint.

Re:Unix Shell Programming: The Next 50 Years [pdf] by oblio on Friday June 04, 2021 @03:23PM (#27397950)
Yeah, but in the modern era, where almost all the ancient Unixes are for all practical purposes dead (you basically have to be an IBM consultant to use AIX, an HP consultant to use HP-UX, an Oracle consultant to use Solaris, *BSDs probably have 0.01% of Linux' usage rate), we live in a Linux mono culture.

99.99% of everything is internet connected and auto-updates. New distro versions come out every 2 years.

There's no real reason why bash couldn't have been evolved into a sane language with sane parsing and with modern constructs. By sane, I mean... read this:

https://www.oilshell.org/blog/

At least these articles:

https://www.oilshell.org/blog/2021/01/why-a-new-shell.html (especially this one)

https://www.oilshell.org/blog/2016/10/20.html

https://www.oilshell.org/blog/2016/10/28.html

https://www.oilshell.org/blog/2016/11/06.html

If freaking Javascript could "use strict;" and turn a page, bash could have definitely have done the same.

It's just that there's no real commercial interest and FSF doesn't have the manpower (or desire) to do this.

Re:Unix Shell Programming: The Next 50 Years [pdf] by chubot on Friday June 04, 2021 @10:24PM (#27401428)
Yes 'use strict;' is a great analogy! I mentioned that here with regard to Perl 5:

https://www.oilshell.org/blog/2020/07/blog-roadmap.html#the-...

It turns out that bash's "shopt" can be co-opted for this, and that's exactly what Oil does. For example, after 'shopt --set parse_paren', you can do this:

    if (x > 0) {  # parens are now Python-like expressions, not subshell!
      echo "$x is positive"
    }
Yes I agree bash could have done this. But the bash codebase is very fragile and things often break. The maintainers are very concerned about breakage.

Oil is written in a way to make breakage less likely: with principled parsing and a detailed code representation using algebraic data types. I'm surprised at how much language evolution this style has enabled. It makes me optimistic about the project's future!

Although we still tons of work to do with the C++ translation -- writing a shell is hard either way!

Re:Unix Shell Programming: The Next 50 Years [pdf] by oblio on Saturday June 05, 2021 @05:08AM (#27403447)
> Yes I agree bash could have done this. But the bash codebase is very fragile and things often break. The maintainers are very concerned about breakage.

True, but that's not a good reason for such a used application. It has been around for 40 years, I think it literally has trillions of runtime hours. It's used on billions of systems, most likely.

It's exactly the place where you'd create a super comprehensive test suite that covers <<everything>> (see SQLite) and then re-architect it to make it robust.

I wonder if it's due to lack or money or due to something else.

Re:Unix Shell Programming: The Next 50 Years [pdf] by JadeNB on Saturday June 05, 2021 @08:33AM (#27404390)
> There's no real reason why bash couldn't have been evolved into a sane language with sane parsing and with modern constructs. By sane, I mean... read this:

> https://www.oilshell.org/blog/

I think the point is that, it did evolve, as your link shows—and there are lots of other sane alternative shells, too. The problem isn't that they don't exist; it's getting people to adopt them in sufficient numbers.

Re:Unix Shell Programming: The Next 50 Years [pdf] by gnubison on Sunday June 06, 2021 @12:00AM (#27410686)
> *BSDs probably have 0.01% of Linux' usage rate

Just wanted to point out that Hacker News runs on FreeBSD[0] :) Some people like the BSDs, and would appreciate it if everybody stopped designing for the Linux monoculture (well, monoculture if you disregard Windows and macOS).

[0] https://docs.freebsd.org/en/books/handbook/introduction/

Re:Unix Shell Programming: The Next 50 Years [pdf] by oblio on Sunday June 06, 2021 @10:42AM (#27413497)
Hacker News runs on FreeBSD and Arc, Arc being a super obscure Lisp dialect that I can't imagine being used in production anywhere else (for sure not in a place with a similar visibility or impact).

"What HN uses" doesn't say much about tech trends :-)

Edit: You probably want to use Netflix as a better example. I think it's used by their CDN layer.