▲ | matheusmoreira 2 days ago | ||||||||||||||||||||||||||||||||||
This honestly should be the default for all scripts. There are so many little annoyances in bash that would make it great if they were changed and improved. Sadly there's just no changing certain things. My number one wishlist feature was a simple library system. Essentially just let me source files by name by searching in some standard user location. I actually wrote and submitted patches for this but it just didn't work out. Maintained my own version for a while and it was nice but not enough to justify the maintenance burden. Bash's number one feature is being the historical default shell on virtually every Linux distribution, without that there's no point. At least we've got shellcheck. | |||||||||||||||||||||||||||||||||||
▲ | dhamidi 2 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
The `source` builtin searches through all directories on PATH, not quite a library system, but useable with a bit of discipline in the to-be-sourced shellscripts. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
▲ | abathur 2 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
When you say library system, do you mean something more or less like a separate search path and tools for managing it? I've written a little about how we can more or less accomplish something like meaningfully-reusable shell libraries in the nix ecosystem. I think https://www.t-ravis.com/post/shell/the_missing_comprehensive... lays out the general idea but you can also pick through how my bashrc integrates libraries/modules (https://github.com/abathur/bashrc.nix). (I'm just dropping these in bin, since that works with existing search path for source. Not ideal, but the generally explicit nature of dependencies in nix minimizes how much things can leak where they aren't meant to go.) | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
▲ | oneshtein 2 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
bash-modules project tries to implement "modules", which works in strict mode, but it got no traction. | |||||||||||||||||||||||||||||||||||
|