Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Every few years someone writes a hot take titled something like "Stop Writing Shell Scripts." They're usually not wrong, but they're not entirely right either. Shell scripting is a first-class skill that modern infrastructure engineers dismiss at their peril.

The Case for Bash

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. The beauty of bash is its universality. Every POSIX system ships with a shell. You don't install a runtime. You don't vendor dependencies. You write a file that starts with #!/bin/sh and it runs. That's extraordinary.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Consider the alternative: a Python script requires the right Python version. A Go binary needs to be built for the right architecture. A Node script requires npm and a node_modules tree the size of a small country.

"The shell is the glue of the Unix philosophy. It is the language of the command line, and command lines are forever."

When I Reach for Shell First

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.

  • Gluing together existing CLI tools (find, grep, awk, sed)
  • File and directory manipulation at scale
  • Quick CI/CD pipeline steps that don't warrant a full language
  • Bootstrapping machines before any runtime exists
  • Cron jobs that should be transparent and auditable

A Real Example

Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Here's a script I wrote last week that replaced 200 lines of Python:

#!/usr/bin/env bash
# rotate-logs.sh — archive and compress logs older than 7 days
set -euo pipefail

LOG_DIR="${1:-/var/log/app}"
ARCHIVE_DIR="${2:-/var/log/archive}"
DAYS="${3:-7}"

mkdir -p "$ARCHIVE_DIR"

find "$LOG_DIR" -maxdepth 1 -name "*.log" -mtime +"$DAYS" | while read -r f; do
    base="$(basename "$f")"
    echo "[+] archiving: $base"
    gzip -c "$f" > "$ARCHIVE_DIR/${base%.log}-$(date +%Y%m%d).log.gz"
    rm "$f"
done

echo "[✓] done — $(find "$ARCHIVE_DIR" -name '*.gz' | wc -l) archived files"

Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit. That's it. Portable, readable, and it does exactly one thing well.

The Limits

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident. I'm not here to pretend bash is a general-purpose language. It isn't. The moment you need:

  • Complex data structures (maps of maps, etc.)
  • HTTP clients with real error handling
  • Parallelism beyond & and wait
  • A test suite larger than a handful of assertions

…reach for Python, Go, or whatever fits your team's idioms. The skill is knowing when to switch, not insisting on one tool forever.

Conclusion

Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Shell scripting isn't legacy technology any more than the filesystem is legacy technology. It's the foundation. Know it well, reach for it when it fits, and don't apologize for the .sh extension.

Now go write something. The terminal is waiting.