In order to test some scripts1 in as many environments as possible, I've set up several VMs with UNIX (or Unix-like operating systems):
- OS X2
I assume, though, that in many ways it's actually more important to test using different versions of each shell that I plan to care about, than to test using different operating systems.
Since I'd rather not have my VMs multiply in seemingly endless permutations, I'd like to install multiple versions of each shell on any given VM. For instance, if I test under
[:bash,:zsh,:fish,:ksh,:csh,:tcsh,:sh,:dash,:ash] then I've got 9 shells, and if you assume I'm testing an average of 3 versions of each then I've got over 100 VMs:
# operating_systems * shells * shell_versions 4 * 9 * 3
Is there any practical way to install and use multiple versions of a given shell on a single machine or virtual machine? Can I (e.g.) install Bash 1, Bash 2, Bash 3, and Bash 4 all on one Linux VM?
I realize that
- some combinations are less important and can probably be ignored, and
- ultimately I'd want to test multiple versions of each OS as well,
but those are really separate to this question, so I'm putting such issues aside to consider whether this is possible:
So: is there any practical way to install and use multiple versions of a given shell on a single machine?
1 I'm using the term "script" loosely. One of the first things I want to test is something that will be sourced by one's shell
rc files, whether that be
.bash_profile, or whatever, so it won't have its own shebang line. Hence the desire to make one bit of code work across multiple shells. Other things that would be useful across shells would be functions and aliases that I'd want to use on different machines although they won't necessarily all have my favorite shell (Z Shell) but might make me use Bash or Korn. Also any useful snippets that I might want to use in shell scripts on multiple machines, even when I can't put my favorite shell in the shebang line.
2 Totally tangential note, only included for the sake of not saying anything misleading: I haven't actually gotten the OS X VM set up, since this is quite a hassle, but I hope to, and included it in the list so no one would say "Hey! Why aren't you including OS X!?"