Your login shell might be zsh on macOS or fish on a personal machine, but Bash remains the lingua franca for portable scripts and CI images.
Common shells
- sh — POSIX subset; maximum portability for minimal scripts
- bash — extensions: arrays,
[[ ]], process substitution - zsh — macOS default login shell; strong completion and globbing
- fish — friendly UX; not POSIX—poor fit for generic CI scripts
Check your shell
echo "$SHELL"
ps -p $$ -o comm=$SHELL is your login shell path. ps shows what is running this session.
When to pick Bash
Use Bash when a script must run on generic Linux CI runners and tutorials assume #!/bin/bash. Use zsh/fish locally if you prefer—keep project scripts on Bash unless the team standardizes otherwise.
Important interview questions and answers
- Q: Why do CI images default to Bash?
A: Scripts and docs target Bash; POSIX sh is used when portability beats Bash-only features. - Q: Can zsh run Bash scripts?
A: Often yes for simple scripts, but Bash-only syntax breaks—test in Bash explicitly.
Self-check
- What does the shebang line tell the kernel?
- Why might a macOS user still learn Bash if zsh is the login shell?
Tip: Write portable project scripts for bash unless your team standardizes on POSIX sh only.
Interview prep
- Why learn Bash if zsh is default on macOS?
CI and Linux servers overwhelmingly use Bash for scripts and job steps.
- sh vs bash shebang?
sh maximizes portability; bash enables arrays, [[ ]], and richer scripting.