Running bash on Non-Linux Systems
Before we talk about the alternatives to bash
, let’s talk about using bash
on non-Linux operating systems. I mean, the easiest way to make your shell scripts portable is to have the same shell everywhere.
As I mentioned in the introduction, bash
is already installed on most Linux-based operating systems, as well as on macOS and OpenIndiana. If you want to use bash
on a BSD-type distro, such as FreeBSD or OpenBSD, you’ll need to install it yourself. I’ve already shown you how to install bash
on FreeBSD in Chapter 8, Basic Shell Script Construction. To refresh your memory, I’ll show you again:
donnie@freebsd14:~ $ sudo pkg install bash
It’s just as easy on any other BSD-type distro, except that they all use different package managers. Here’s the table of commands for the various BSDs:
BSD Distro |
Command to install bash... |