16 ms·
If you need something this elaborate, you really shouldn't be writing it in Bash in the first place. Anytime I find myself wishing I had arrays, or real data t
by massysett 10y ago
If you need something this elaborate, you really shouldn't be writing it in Bash in the first place.
Anytime I find myself wishing I had arrays, or real data types, or real functions, I stop using shell languages immediately. Shell scripts are really only suitable for the exact same sorts of things I would type myself at a Unix prompt...and since those sorts of things are rarely more than a few lines long, shell scripts shouldn't be longer than that either.
- esmi 10y agoI can think of some cases where it might make sense depending on the specific details. For example if you already had tons of scripts that you wanted to wrap and one couldn't install things as root this could be the quickest path forward. The nice thing about shell languages (like sh and to some extent bash) is they run everywhere with minimum dependancies. This makes them great for things like build environment configuration. Those scripts can easily get very complex and it's nice to have some built-in tools to help keep it under control.
- finavorto 10y agoAgreed. The shell is a gateway to programming, it shouldn't be treated as an environment for code in itself.