sh Tutorial

sh is not a single shell. Rather, it is a specification with the POSIX operating system standard for how a shell should work. A script that targets this specification can be executed by any POSIX-compliant shell, such as

  • bash
  • ksh
  • ash and its derivatives, such as dash
  • zsh

In a POSIX-compliant operating system, the path /bin/sh refers to a POSIX-compliant shell. This is usually a shell that has features not found in the POSIX standard, but when run as sh, will restrict itself to the POSIX-compliant subset of its features.