4 ms·
Shells have some of the absolutely bonkersly dumb parsers and interpreters Oils fixes all this, it's a from-scratch reimplementation of shell with an upgrade p
by chubot 3y ago
Shells have some of the absolutely bonkersly dumb parsers and interpreters
Oils fixes all this, it's a from-scratch reimplementation of shell with an upgrade path from OSH (compatible) to YSH (new).
---
aliases that can override keywords and change the parsing of shell script
You can control this with shopt -u expand_aliases in bash, and YSH turns it off by default.
Oils is statically parsed: How To Parse Shell Like a Programming Language - https://www.oilshell.org/blog/2019/02/07.html https://www.oilshell.org/blog/2019/02/07.html
---
look up how "[" and "]" is handled in some shells--it might not be!
OSH runs POSIX [ as-is, for compatibility:
osh$ [ x = x ] && echo yes
yes
But YSH nudges you toward a "saner" style:
ysh$ [ x = x ] && echo yes
[ x = x ] && echo yes
^
[ interactive ]:2: '[' should be invoked as 'test' (simple_test_builtin)
It also gives you a more familiar syntax. It's for Python and JavaScript users who avoid shell:
ysh$ if ('x' === 'x') { echo yes }
yes
---
A Tour of YSH - https://www.oilshell.org/release/latest/doc/ysh-tour.html https://www.oilshell.org/release/latest/doc/ysh-tour.html
Why Create a New Shell? - https://www.oilshell.org/blog/2021/01/why-a-new-shell.html https://www.oilshell.org/blog/2021/01/why-a-new-shell.html
(OSH is very stable and compatible, but YSH isn't stable yet. Getting there)
- justahuman74 3y agoI'm pretty excited about YSH As a heavy user of bash I'm fully aware of how unaware I am of everything that can go wrong.
- chubot 3y agoCool! If you use and know bash, right now OSH with shopt -s strict:all will prevent almost all of the "silent footguns". On the other hand, YSH has strict:all and then a bunch of NEW features. There's been good feedback recently, which has led to many concrete changes. So your experience can definitely influence the language! https://github.com/oilshell/oil/wiki/Where-To-Send-Feedback https://github.com/oilshell/oil/wiki/Where-To-Send-Feedback
- nindalf 3y agoI hope this can become the new standard shell. https://xkcd.com/927/ https://xkcd.com/927/
- lamontcg 3y agoIt wont. And stuff like Solaris and AIX still lives on and uses /bin/sh and has been incredibly slow to embrace even bash, and configure scripts still need to support them. Plus any change you make today won't be remotely universal until 10 years has passed. And back in 2005-ish I thought for sure that we'd have standardized on perl as a replacement for bash scripting by now.
- chubot 3y agoWhat's different about Oils is that it's compatible with both /bin/sh and bash. https://www.oilshell.org/blog/2021/01/why-a-new-shell.html https://www.oilshell.org/blog/2021/01/why-a-new-shell.html https://www.oilshell.org/blog/2023/03/faq.html https://www.oilshell.org/blog/2023/03/faq.html OSH should be trivial to use on Solaris/AIX -- all you need is a C++ compiler and /bin/sh, no make tool even. https://www.oilshell.org/blog/2023/12/screencasts.html#appendix https://www.oilshell.org/blog/2023/12/screencasts.html#appen... But if everyone on Linux and BSD uses bash/OSH, and Solaris AIX use /bin/sh, it will be a success. The latter platforms do not influence the rest of computing very much -- they lag behind. --- The busybox shell and the FreeBSD shell have been gaining bash features lately -- which means they are gaining OSH features. Because OSH is the most bash-compatible shell, by a mile. There's no other project like it. --- I agree with the logic -- it is very hard to change languages. It's like changing English to Esperanto. The inertia is incredible. So you need to provide an upgrade path, and that's what Oils does. OSH is compatible, and YSH is a new design.
- lamontcg 3y agoSure but the problem is that Solaris/AIX will be very slow to actually install it, so you can't count on it being there, and those distros DO influence things like autoconf and configure scripts. And people who run them pay big money contracts to get those distros supported (one bank contract for support is worth much more than 10,000 linux users who don't pay anyone a dime). The inertia is very real, bigger than you even think, and you can't wave it off by suggesting they don't influence computing. At any rate, you need to actually accomplish everyone on Linux and BSD having that available and having used it for the past 10 years first. And get the core distros switching over to using it so that the glue code in the distro is all YSH plus probably python and some legacy sh. Actually show me that. And yeah, I think the analogy of trying to change English to Esperanto is about right. I learned about Esperanto in the mid-80s...