Bird
0
0

Why does the following bash assignment fail?

hard🧠 Conceptual Q10 of 15
Bash Scripting - Variables
Why does the following bash assignment fail?
var =value
ABecause variable names cannot start with v
BBecause spaces around = are not allowed in bash variable assignment
CBecause value must be quoted
DBecause echo is missing
Step-by-Step Solution
Solution:
  1. Step 1: Identify syntax rules for variable assignment

    Bash does not allow spaces around the = sign in variable assignment.
  2. Step 2: Check other options for validity

    Variable name starting with 'v' is valid; quotes are optional for simple strings; echo is unrelated.
  3. Final Answer:

    Because spaces around = are not allowed in bash variable assignment -> Option B
  4. Quick Check:

    No spaces allowed around = [OK]
Quick Trick: No spaces allowed around = in bash variable assignment [OK]
Common Mistakes:
MISTAKES
  • Adding spaces around =
  • Misunderstanding variable name rules
  • Forgetting quotes when needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes