Bird
0
0

Which option correctly reads two words into two separate variables using the read command?

easy🧠 Conceptual Q2 of 15
Bash Scripting - User Input
Which option correctly reads two words into two separate variables using the read command?
Aread -w var1 var2
Bread var1,var2
Cread var1 var2
Dread var1; read var2
Step-by-Step Solution
Solution:
  1. Step 1: Understand how read splits input

    read var1 var2 splits input by spaces into two variables.
  2. Step 2: Check other options for syntax

    Options A and C use invalid syntax; D reads twice separately, not simultaneously.
  3. Final Answer:

    read var1 var2 -> Option C
  4. Quick Check:

    Multiple variables = space-separated input [OK]
Quick Trick: Use spaces to assign multiple variables with read [OK]
Common Mistakes:
MISTAKES
  • Using commas instead of spaces
  • Adding unsupported flags like -w
  • Trying to read variables in separate commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes