Interview Prep/Shell Scripting/Shells, scripts and execution

What is a shell, and how is Bash different from sh, dash and zsh?

BeginnerConceptShells, scripts and execution
Answer

A shell is a command interpreter: it reads commands, expands them, and starts programs. sh is the POSIX standard language, implemented on Debian/Ubuntu by dash (small, fast, no arrays or [[ ]]) and on RHEL by Bash in POSIX mode. Bash is a superset of POSIX sh with arrays, [[ ]], (( )), process substitution and better interactive features. zsh is the macOS default interactive shell; it is mostly compatible but differs in word splitting and array indexing (arrays start at 1).

In production we write automation in Bash with an explicit #!/usr/bin/env bash shebang, and only target POSIX sh when the runtime forces it (Alpine, BusyBox, minimal containers).

All Shell Scripting questions Roadmap: Shell scripting (Bash)

More on Shells, scripts and execution