OSH is the most bash-compatible shell in the world, and YSH is a new language
ls | sort | uniq | wc -l # this is both OSH and YSH
var mydict = {foo: 42, bar: ['a', 'b']} # this is new YSH stuff you can start using
json write (mydict)
The difference between OSH and YSH is exactly a set of "shopt" options [1], although YSH feels like a brand new language too! There is a smooth blend.
I think it's worth it for 2 things alone
- YSH checks all errors - you never lose an exit code
- YSH has real arrays and doesn't mangle your variables with word splitting
There's a lot more: modules with namespaces (use mymodule.ysh), buffered I/O that's not slow, etc.
https://www.oilshell.org/
OSH is the most bash-compatible shell in the world, and YSH is a new language
The difference between OSH and YSH is exactly a set of "shopt" options [1], although YSH feels like a brand new language too! There is a smooth blend.I think it's worth it for 2 things alone
- YSH checks all errors - you never lose an exit code
- YSH has real arrays and doesn't mangle your variables with word splitting
There's a lot more: modules with namespaces (use mymodule.ysh), buffered I/O that's not slow, etc.
Gradually upgrading -https://github.com/oils-for-unix/oils/wiki/Gradually-Upgradi... (people are writing new YSH, but not many people have gradually upgraded, so I'd definitely appreciate feedback from people with a big "shell script problem")
---
There is a FAQ here about Perl:
Are you reinventing Perl? - https://www.oilshell.org/blog/2021/01/why-a-new-shell.html#a...
Not to say that migrating to Perl is worse in any way, i.e. if you already know Perl or your team knows it.
But objectively YSH is also a shell, so I think more of the code carries over, and there is a more direct upgrade path.
---
[1] Unix Shell Should Evolve like Perl 5 - https://www.oilshell.org/blog/2020/07/blog-roadmap.html#the-... - i.e. with compatible upgrade options