Bird
0
0

Which command correctly prompts the user with "Enter age:" and stores the input in variable age?

easy🧠 Conceptual Q2 of 15
Bash Scripting - User Input
Which command correctly prompts the user with "Enter age:" and stores the input in variable age?
Aread age "Enter age:" -p
Bread age -p "Enter age:"
Cread -p "Enter age:" age
Dread -age -p "Enter age:"
Step-by-Step Solution
Solution:
  1. Step 1: Syntax of read -p

    The correct syntax is read -p "prompt" variable.
  2. Step 2: Match syntax with options

    Only read -p "Enter age:" age matches this syntax exactly.
  3. Final Answer:

    read -p "Enter age:" age -> Option C
  4. Quick Check:

    Correct syntax = A [OK]
Quick Trick: Prompt text goes right after -p, then variable name [OK]
Common Mistakes:
MISTAKES
  • Placing variable before -p
  • Using invalid flags like -age
  • Putting prompt after variable

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes