Bash / Basic: syntax, values, and control
Bash β Basic: syntax, values, and control
Build exact models for expansion, quoting, parameters, statuses, functions, and arrays.
What you will learn
- Predict argument count and preserve data values.
- Write clear functions and control flow with documented contracts.
Read Bash as a command language
Follow lexical words, shell grammar, expansion, redirection, command lookup, and status instead of treating a line as an opaque string.
Start learningPreserve argument boundaries through quoting
Predict word splitting and filename expansion, then use literal arguments and Bash arrays instead of strings that merely resemble commands.
Start learningDesign parameter and string contracts
Use positional parameters, defaults, substring operations, and explicit value validation while preserving unset and empty distinctions.
Start learningMake status and control flow explicit
Use command results, conditions, case selection, and loops without assuming printed output or set -e defines success.
Start learningBuild functions with clear state boundaries
Define argument, output, status, and state contracts for small reusable Bash functions without confusing sourcing with child execution.
Start learningRepresent lists and keyed data with arrays
Use indexed and associative Bash arrays to preserve values, distinguish keys from positions, and avoid undocumented iteration assumptions.
Start learning