Hey everyone! I'm working on some development tools for my team and want to ensure that all users have the latest version of Bash for consistent script execution. I'm currently using Mise to manage versions of other languages but I can't find any support for pinning Bash. Have any of you figured out a good way to manage Bash versions across the team? Preferably using Mise, but I'm open to other suggestions too!
5 Answers
Why not just use Docker for this? It could simplify managing different environments, but I understand if you're looking for something specific to local toolchains.
Have you considered using Nix? It’s really handy for managing tool versions and could help you with your Bash versioning issue.
I’d lean towards avoiding version changes for something as integral as Bash. It’s a core part of the OS, while languages like Python are more easily changeable without much risk. You really don’t want to be responsible for potential system outages just to meet specific version demands.
You might want to make your tools compatible with older Bash versions too. Some folks might not be comfortable upgrading their system's shell, fearing it could break things.
One approach is to add a version check at the start of your Bash scripts. This lets the developers manage their own Bash installations. Something like:
```bash
#!/usr/bin/env bash
((
BASH_VERSINFO[0] > 4 ||
BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 4
)) || {
printf >&2 '%s: Bash version 4.4 or newer requiredn' "$0"
exit 1
}
```
We're actually focused on managing local toolchains across a monorepo, not on containerizing applications. Docker isn't quite the fit for what we're doing.