5 ms·
I agree, and that was out of the motivations for https://www.oilshell.org/ https://www.oilshell.org/ It runs your bash scripts but you can also opt into correc
by chubot 4y ago
I agree, and that was out of the motivations for https://www.oilshell.org/ https://www.oilshell.org/
It runs your bash scripts but you can also opt into correct error handling. The simple invariant is that it doesn't lose an exit code, and non-zero is fatal by default.
Oil 0.10.0 - Can Unix Shell Error Handling Be Fixed Once and For All?
https://www.oilshell.org/blog/2022/05/release-0.10.0.html https://www.oilshell.org/blog/2022/05/release-0.10.0.html
This took quite awhile, and I became aware of more error handling gotchas than I knew about when starting the project:
https://www.oilshell.org/release/latest/doc/error-handling.html https://www.oilshell.org/release/latest/doc/error-handling.h...
e.g. it's impossible in bash to even see the error status of a process sub like diff <(sort left.txt) <(sort OOPS)
If you have bash scripts that you don't want to rewrite, try
1) run them with OSH
2) Add shopt --set oil:upgrade at the top to get the error handling fixes.
Tell me what happens :) https://github.com/oilshell/oil https://github.com/oilshell/oil
I spent a long time on that, but the post didn't get read much. I think it's because it takes a lot of bash experience to even understand what the problem is.
- riffraff 4y ago> Add shopt --set oil:upgrade at the top to get the error handling fixes How does this work? It seems magic
- chubot 4y agoRight now there are 22 options that form the fixes and enhancements to bash: oil$ shopt -p oil:upgrade shopt -s command_sub_errexit shopt -u dashglob shopt -s errexit shopt -u expand_aliases shopt -s inherit_errexit ... Some affect parsing and some affect execution. OSH is a bash-compatible shell, from scratch! :) Let me know what happens