Bash / Shell Scripting

Write reliable Bash scripts: quoting, expansions, tests and loops, functions and arrays, redirection and pipes, strict mode, traps, ShellCheck and cron.

कोर्स शुरू करें →

आप क्या सीखेंगे

  • Explain what Bash is, how it relates to sh, dash and zsh, and how scripts are run and exit.
  • Use variables, quoting and parameter expansion correctly to avoid word-splitting and globbing bugs.
  • Write conditions, loops, functions and arrays, and parse command-line options with getopts.
  • Redirect streams, build safe pipelines and process text and JSON with grep, sed, awk and jq.
  • Make scripts robust with strict mode, traps, temporary files, locking, atomic writes and ShellCheck.
  • Automate tasks with background jobs, cron and systemd timers, and know when to switch to another language.

पाठ्यक्रम

Shells and Your First Script

  1. What Bash Is
  2. Shebang, Permissions, PATH and Exit Codes
  3. Builtins, External Commands, Aliases and Functions

Variables, Quoting and Expansion

  1. Variables and the Environment
  2. Quoting, Word Splitting and Globbing
  3. Parameter Expansion, Command Substitution and Arithmetic

Conditions and Loops

  1. Tests: [[ ]], [ ] and (( ))
  2. if, elif, case and Short-Circuit Operators
  3. for, while and Reading Lines Safely

Functions, Arrays and Arguments

  1. Functions, Arguments and Return Values
  2. Indexed and Associative Arrays
  3. Parsing Options with getopts

Input, Output and Text Processing

  1. Redirection and Here-Documents
  2. Pipelines, pipefail, Process Substitution and xargs
  3. Text Processing with grep, sed, awk and jq

Writing Robust Scripts

  1. Strict Mode: set -euo pipefail and Its Caveats
  2. Traps, Cleanup and Temporary Files
  3. Debugging, ShellCheck and Formatting

Processes, Files and Automation

  1. Background Jobs, wait and Signals
  2. Safe File Handling
  3. Scheduling with cron and systemd Timers

Script Design, Limits and Revision

  1. A Production Script Template
  2. When Not to Use Bash, and Portability
  3. Case Study: A Database Backup Script
  4. Revision and Interview Questions