Linux Shell Scripting

Bash Variables Quoting and Expansion

Control Bash variables, parameter expansion, quoting, command substitution, and arrays so data does not become accidental shell syntax.

Intermediate14 min read
Linux Shell Scripting lessonLinuxPractice

UNTIMED COACHING

Practice before the pressure

Use feedback to correct the model, not merely memorize an option position.

GUIDED PRACTICE

Practice the lesson questions

Answer normal lesson questions without a timer. Every answer includes an explanation, and incorrect answers can be tried again before continuing.

CONCEPT MODELS

See the lesson as a system

Use these visual guides to connect the key ideas before answering the questions.

From Variable assignment to Single quotesConnect variable assignment with parameter expansion, double quotes, and single quotes.
From Variable assignment to Single quotesA learning path connects four specific concepts used in bash variables quoting and expansion and states the outcome of each one.
Variable assignmentNamed shell value is available for expansion
Parameter expansionParameter value becomes part of the command
Double quotesExpanded value remains a single argument
Single quotesEnclosed text reaches the command literally
Command substitution: command and checksConnect command substitution with the starting command, expected result, and specific safety boundary.
Command substitution: command and checksA practical check connects command substitution to the relevant command, expected evidence, and caution.
Command substitutionFocus on command substitution
Starting commandUse current_dir=$(pwd)
Expected resultCommand output becomes a shell value
Safety boundaryDiagnostics and exit status need handling