Skip to content
Learn Netverks

Lesson

Step 3/36 8% through track

bash-vs-other-shells

Bash vs other shells

Last reviewed May 28, 2026 Content v20260528
Track mode
none
Means
Read / quiz
Reading
~2 min
Level
beginner

This lesson

This lesson teaches Bash vs other shells: the syntax, patterns, and safety habits you need before advancing in Bash.

Teams still ship Bash vs other shells in Bash codebases—skipping it leaves gaps in debugging and code reviews.

You will apply Bash vs other shells in contexts like: CI jobs, server maintenance, local dev automation, and Git hooks.

Read each lesson, copy bash examples into your own terminal, and complete the lesson MCQs—there is no in-browser runner for security reasons.

At the start of the track—complete before lessons that assume you can run commands in your own terminal.

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

  1. Q: Why do CI images default to Bash?
    A: Scripts and docs target Bash; POSIX sh is used when portability beats Bash-only features.
  2. Q: Can zsh run Bash scripts?
    A: Often yes for simple scripts, but Bash-only syntax breaks—test in Bash explicitly.

Self-check

  1. What does the shebang line tell the kernel?
  2. 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.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • When use Python?
  • POSIX sh when?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump