Skip to main content

📘 Bash Scripting Curriculum – Focused on Core Capabilities (WordPress Server Context)


1. Bash Fundamentals & Environment Setup​

ModuleCapabilityDescription
1.1History & Role of BashUnderstand why Bash is the default Linux shell and its role in automation and scripting.
1.2Shell vs Terminal vs BashDifferentiate shell environments and how Bash interprets commands.
1.3Environment SetupConfigure .bashrc, .profile, PATH variables, and aliases.
1.4Running ScriptsExecute scripts interactively or non-interactively, with permissions (chmod +x).
1.5Shebang (#!)Specify interpreter path for reliable script execution.

2. Syntax & Command Structure​

ModuleCapabilityDescription
2.1Command GroupingCombine commands using {}, ( ), and subshells.
2.2Command ChainingUse ;, &&, and `
2.3Exit Status CodesInterpret $? to manage success/failure flow.
2.4Quoting & EscapingManage literal and expanded strings using ", ', and \.
2.5CommentsDocument scripts with # for readability and maintenance.

3. Variables & Parameters​

ModuleCapabilityDescription
3.1Variable DeclarationDefine and reference user-defined variables.
3.2Environment VariablesManage system variables ($PATH, $HOME, $USER).
3.3Positional ParametersAccess arguments passed to scripts ($1, $2, $@).
3.4Special VariablesUnderstand $?, $$, $!, $UID, $RANDOM.
3.5Parameter ExpansionModify or substitute variable content (${var//old/new}).

4. Input, Output & Redirection​

ModuleCapabilityDescription
4.1Standard StreamsUnderstand stdin, stdout, and stderr.
4.2Redirection OperatorsRedirect outputs (>, >>, <, 2>, &>).
4.3PipingPass output from one command to another using `
4.4Tee CommandDisplay and write outputs simultaneously.
4.5Here Documents & StringsUse << and <<< for inline input blocks.

5. Conditional Logic & Flow Control​

ModuleCapabilityDescription
5.1If / ElseImplement branching conditions in scripts.
5.2Comparison OperatorsCompare integers, strings, and files (-eq, -lt, ==, !=).
5.3File & Directory TestsUse test operators (-f, -d, -r, -w, -x).
5.4Case StatementsSimplify multi-branch logic with case ... esac.
5.5Exit ControlUse exit, break, and continue effectively.

6. Loops & Iteration​

ModuleCapabilityDescription
6.1For LoopsIterate through lists, arrays, or directories.
6.2While & Until LoopsPerform repeated actions based on conditions.
6.3Loop ControlManage loop execution using break and continue.
6.4Nested LoopsBuild structured repetition for complex logic.
6.5Practical UseAutomate repetitive system or file operations.

7. Functions & Modularity​

ModuleCapabilityDescription
7.1Declaring FunctionsCreate reusable blocks of code.
7.2Function ArgumentsAccess and handle parameters inside functions.
7.3Local VariablesRestrict variable scope with local.
7.4Return ValuesManage success or error codes from functions.
7.5Sourcing FilesReuse shared functions with source or ..

8. String & Text Operations​

ModuleCapabilityDescription
8.1String ManipulationExtract, slice, and modify strings.
8.2Pattern MatchingUse wildcards (*, ?) and regex with [[ ]] or =~.
8.3Parameter SubstitutionApply ${var#}, ${var%}, ${var//} expansions.
8.4String ComparisonCompare and test string equality or length.
8.5Case ConversionTransform case (${var^^}, ${var,,}).

9. File & Directory Operations​

ModuleCapabilityDescription
9.1File TestsCheck existence and type using test operators.
9.2Create / RemoveAutomate file or folder creation/deletion (touch, mkdir, rm).
9.3Copy / MoveManage data relocation using cp and mv.
9.4SymlinksCreate or manage symbolic links with ln -s.
9.5Path OperationsManipulate file paths using basename, dirname, realpath.

10. Archiving & Compression (Bash Native)​

ModuleCapabilityDescription
10.1Using tarCreate and extract archives with Bash commands.
10.2Gzip & GunzipCompress or decompress files efficiently.
10.3Zip & UnzipArchive using zip utilities from scripts.
10.4Combine CommandsPipe output for chained compression workflows.
10.5File IntegrityValidate success of archiving operations via exit codes.

11. Error Handling & Debugging​

ModuleCapabilityDescription
11.1Exit StatusCheck return values to detect failures.
11.2Error RedirectionRedirect errors to files using 2> and &>.
11.3Traps & SignalsCatch interrupts (SIGINT, SIGTERM) and execute cleanup.
11.4Debug OptionsEnable tracing with set -x, stop on error with set -e.
11.5Safe ExecutionCombine error handling in automation scripts.

12. Process & Job Control​

ModuleCapabilityDescription
12.1Foreground & Background JobsRun tasks in background using &, fg, bg.
12.2Job ListingView and manage running tasks with jobs.
12.3PID HandlingUse $!, kill, and wait for process control.
12.4SubshellsExecute isolated commands in a separate environment.
12.5Daemon ScriptsBuild scripts that run persistently in background.

13. Date & Time Utilities​

ModuleCapabilityDescription
13.1Date CommandRetrieve and format dates with date.
13.2Time ArithmeticUse date -d for relative date operations.
13.3Sleep & DelayPause script execution with sleep.
13.4Script TimingMeasure runtime with time command.
13.5TimestampingAppend date/time to log and backup filenames.

14. Scheduling & Automation​

ModuleCapabilityDescription
14.1Cron JobsSchedule recurring Bash script execution.
14.2At CommandSchedule one-time jobs.
14.3Intervals & LoopsCreate manual timing inside scripts using sleep.
14.4Log RedirectionRecord automation results with >> logfile.
14.5Job VerificationValidate cron or script status via exit codes.

15. Advanced Bash Concepts & Integration​

ModuleCapabilityDescription
15.1Regular ExpressionsMatch text patterns inside [[ ]] using =~.
15.2Command SubstitutionEmbed command results inside variables ($(command)).
15.3Parallel ExecutionRun multiple processes concurrently using background jobs.
15.4Arrays & Associative ArraysStore multiple values and access dynamically.
15.5Script OptimizationUse functions, lazy evaluation, and modularization for performance.