3 ms·
Why not bash? It’s in most places, even if POSIX is even more general. And it does add some nice scripting features. I use zsh for interactive and bash for scr
by pletnes 7y ago
Why not bash? It’s in most places, even if POSIX is even more general. And it does add some nice scripting features.
I use zsh for interactive and bash for scripts for the same reasons as you, though.
- smichel17 7y agoBecause when you find yourself needing bash-specific features, alarm bells should be going off. POSIX sh is good at reminding you to KISS and delegate to other tools.
- fiddlerwoaroof 7y agoI write my scripts in zsh, because its extensions are most useful in scripts, and it’s not too hard just to make it available everywhere you need to work (e.g. you can compile it to be installed in ~/zsh and just copy the installation to your home directory on any machine you need to use. Things like array-linked variables ($path is an array version of $PATH and modifications to one propagate to the other), associative arrays (dictionaries in python) and a handful of other really nice tools (e.g. saner white space handling) make going back to bash for scripts unpleasant.
- roryrjb 7y agoYeah don't get me wrong the bashisms are useful, but I'm hopping between OpenBSD, FreeBSD and Linux (and perhaps sharing scripts with my macOS-using colleagues) and although bash is available on all those platforms and more, POSIX shell will work out of the box without any further configuration.
- JdeBP 7y agoSo you're switching among the Debian Almquist, Bourne Again, FreeBSD Almquist, PD Korn, and Z shells. Surely you could find some way of working the Watanabe, MirBSD Korn, BusyBox Almquist, and Mashey shells into the mix, too? (-: