How it works
A shell is the program that reads the commands typed into a terminal. A shell script saves those commands in a file, with variables, loops and conditions, so a job of twenty manual steps becomes one command. Bash is the standard on Linux servers, Zsh is the default on macOS, and plain POSIX sh is the lowest common denominator that runs almost anywhere.
Scripts glue other programs together: a pipe sends one command's output into the next (find the files, filter them with grep, count them with wc), which is why so many CI pipelines, Dockerfiles, deploy steps and cron jobs are shell. On Windows, PowerShell plays the same role but passes structured objects between commands instead of plain text; it is open source and runs on macOS and Linux too.
Shell is easy to start and easy to get wrong: unquoted variables break on file names with spaces, and failed commands are ignored unless the script opts in to stopping, for example with set -euo pipefail. The ShellCheck linter catches most of these mistakes. Once a script grows past a page or two, Python is usually the better tool.
Shell scripting pros and cons
Pros
- Already installed on every Linux server and Mac
- Natural glue for running and combining command-line tools
- Quick to write for automation, CI steps and server chores
- Skills carry over to every server, container and CI system
Cons
- Quoting rules and silent failures cause subtle bugs
- Differences between Bash, Zsh, sh and PowerShell hurt portability
- Hard to test and maintain once scripts grow large
When to use Shell scripting
Pick it when
- Automating terminal tasks, builds and deployments
- CI pipelines, Docker images and cron jobs
- Short scripts that mostly call other programs
Skip it when
- Logic with complex data, many branches or careful error handling (use Python)
- Scripts that must run unchanged on Windows and Linux, unless written in PowerShell
Shell scripting pricing
Open source
Free: Bash, Zsh and PowerShell are all open source.
Approximate, checked September 2026.What the other tools cost
Related terms
More in Programming languages
Data and scripting