Courseiva

LPIC-1 Shells, Scripting and Data Management Practice Question

Which THREE of the following are types of expansion performed by the bash shell during command parsing?

⚠ Common exam trap

Many candidates confuse alias expansion (which occurs during tokenization) with the formal expansion phases listed in the bash manual, or mistake variable assignment as an expansion type when it is actually a separate parsing step.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Parameter expansion

Parameter expansion (A) is a genuine bash expansion type: the shell replaces constructs like $var, ${var}, or ${var:-default} with their values during command parsing. Tilde expansion (B) is also a real expansion: a leading ~ is replaced with the current user's home directory (or ~user with that user's home), as in ~/file becoming /home/user/file. Brace expansion (C) is likewise a bash expansion type: patterns such as {a,b,c} or {1..5} are expanded into multiple words before other expansions like parameter and command substitution. Variable assignment (D) is not an expansion but a shell operation that stores a value in a variable, and alias expansion (E) is not one of bash's documented expansion stages; aliases are substituted earlier during tokenization/alias lookup, not as a formal expansion type.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Parameter expansion

    Why this is correct

    Parameter expansion substitutes a variable's value, such as $HOME or ${name}, into the command line before execution. Bash performs it during word splitting and expansion, making it one of the shell's documented expansion types alongside tilde, brace, command and arithmetic expansion.

  • ✓

    Tilde expansion

    Why this is correct

    Tilde expansion replaces a leading unquoted tilde with a user's home directory, as in ~/documents becoming /home/user/documents. Bash performs this during command parsing, and it is explicitly listed among the shell's expansion types, satisfying the question's requirement.

  • ✓

    Brace expansion

    Why this is correct

    Brace expansion generates arbitrary strings from a pattern, such as file{1..3}.txt producing three separate words before other expansions run. Bash performs it during command parsing, and it is a documented expansion type, satisfying the question's requirement.

  • ✗

    Variable assignment

    Why it's wrong here

    Variable assignment is a shell operation that stores a value, not an expansion performed during parsing. It is tempting because assignment and expansion both involve variables, yet expansion substitutes a variable's value into the command line; assignment merely sets it, and occurs before the command runs.

  • ✗

    Alias expansion

    Why it's wrong here

    Alias expansion is not one of bash's documented expansion types; aliases are substituted earlier, during alias expansion of the first word of a command. It is tempting because aliases do transform typed text, but the recognised expansions are brace, tilde, parameter, command, arithmetic, word splitting, pathname and quote removal.

About these practice questions

One of 402 original LPIC-1 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LPIC-1 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-1 exam.