On Mon, Apr 08, 2019 at 10:53:46AM -0400, Chet Ramey wrote: > On 4/8/19 10:36 AM, Greg Wooledge wrote: > > > That's incorrect in this context. We're talking about boot scripts here, > > not interactive user shells. In boot scripts, on every operating system > > I've ever used, the shell being used is either POSIX sh or Bourne sh. > > This is clearly wrong in general, though it might be true on systems you've > used (e.g., Debian and Ubuntu in Linuxland). If you have a system where > bash is installed as /bin/sh (e.g., RHEL or Fedora), that is the shell you > use to write boot scripts.
I've used more than just Linux systems. On most commercial Unix derivatives, /bin/sh is either a stripped-down Korn shell variant, or a legacy POSIX or Bourne shell. On some systems (e.g. HP-UX 10), boot scripts use /sbin/sh which is a statically-linked POSIX-based shell, and are only able to use other statically linked tools from the /sbin directory, because the shared libraries aren't mounted yet. At least, until you get past the point where everything is mounted. If you're writing a boot script, YOU need to know when and how that happens, and therefore which tools you can use in which script. But you're right: we actually *do* have at least one Red Hat (CentOS) based system where /bin/sh links to bash. It's the minority, though.