Bird
0
0

Which command correctly prompts the user with Enter username: and stores the input in a variable called username?

easy📝 Syntax Q3 of 15
Bash Scripting - User Input
Which command correctly prompts the user with Enter username: and stores the input in a variable called username?
Aread username "Enter username:"
Bread -p "Enter username: " username
Cread username -p "Enter username:"
Dread -input username "Enter username:"
Step-by-Step Solution
Solution:
  1. Step 1: Understand read syntax

    The read command uses the -p option to display a prompt before reading input.
  2. Step 2: Identify correct usage

    The prompt string must immediately follow -p in quotes, then the variable name.
  3. Final Answer:

    read -p "Enter username: " username -> Option B
  4. Quick Check:

    Prompt with -p then variable [OK]
Quick Trick: Use -p "prompt" before variable name in read command [OK]
Common Mistakes:
MISTAKES
  • Placing variable before -p option
  • Using incorrect option like -input
  • Not quoting the prompt string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes