39 ms·
Agreed; I would also say that you should run from Bash not when you need anything more than a simple array, but when you need any kind of array, period. The ad
by massysett 13y ago
Agreed; I would also say that you should run from Bash not when you need anything more than a simple array, but when you need any kind of array, period.
The advice on functions also gives me pause because that helps you write longer Bash scripts...not a good idea. Functions are of limited use because they can't really return values (just an exit status.) If a function has to return something, it generally prints it to stdout...which requires use of command substitution to get the result...nasty.
Shells are good for interactive use and for starting other programs, but it's a lot easier to take a full-featured language and make it work like a shell than it is to take a shell and make it behave like a full-featured language.
I'd take this blog post, add considerably to the "when you shouldn't use Bash" list, and put that at the top of the blog post, and then say "but if you absolutely must use Bash for something that is not trivial, here are some things that can make the process manageably nasty instead of truly horrid."