4 ms·
Bash has the distinction of effectively being one of the only "zero-dependency" cross-platform scripting languages for most software engineers: "just works" on
by giobox 5y ago
Bash has the distinction of effectively being one of the only "zero-dependency" cross-platform scripting languages for most software engineers: "just works" on Linux/Macs. On Windows, Git for Windows includes gitbash.exe (for cross platform hook-scripts etc), allowing bash scripts to work on Windows boxes as well.
Given the prevalence of git in the software development world, this has meant in my experience bash has very often been the most effective "zero dependency" cross-platform scripting language around. Python/JS/<other runtimes> will rarely work out of the box 100% of the time especially for Windows developers. This makes bash pretty valuable for things like build scripts if you have developers using different OSes.
If your source lives in git, you know there is a good chance user must have gitbash.exe too if they managed to clone a git repo on Windows, thus granting as near as one gets to "zero-dependency" cross-platform scripting in my experience.
- EuAndreh 5y agoThe sh shell, or POSIX sh, is closer to a zero dependency language. There are many systems that have shells which are not bash.
- giobox 5y agoExcellent point, and will still work on recent MacOS versions with zsh/gitbash.exe too.
- _0w8t 5y agoBash on Mac is deprecated and zsh is sufficiently different. Plus on minimal installs of containers or in VM one may not even have it with /bin/sh provided by dash or similar minimal shell. So my rule of thumb if one cannot use plain /bin/sh and must depend on bash-specific things, one better use a proper scripting language.
- jolmg 5y ago> and zsh is sufficiently different But generally not with stuff that one typically uses for scripting. In most ways, it's a superset of bash. Besides word-splitting on unquoted variables being turned off with default settings (which is turned on when zsh is called as bash/sh with a symlink or similar), what other differences do you think would be common to find when running random bash scripts with zsh?
- cachvico 5y agoBuilt-in bash 3 on a Mac is deprecated. But you can use Homebrew to install Bash 5 and make it the new default. Which is what many developers do.