3 ms·
Hm I put all shell code in functions for other reasons, but it's interesting to know it solves another problem. http://www.oilshell.org/blog/2020/02/good-parts
by chubot 7y ago
Hm I put all shell code in functions for other reasons, but it's interesting to know it solves another problem.
http://www.oilshell.org/blog/2020/02/good-parts-sketch.html#the-0-dispatch-pattern-solves-three-important-problems http://www.oilshell.org/blog/2020/02/good-parts-sketch.html#...
To summarize:
1) saving many interactive snippets in a single file -- each one is a function
2) expose entire shell functions to tools like xargs and chroot
3) if $0 myfunc solves the "ignored errexit" problem
now
4) safely modify a bash script while it's executing