Bird
0
0

Which of the following is the correct syntax to read a user's name into a variable called username?

easy📝 Syntax Q12 of 15
Bash Scripting - User Input
Which of the following is the correct syntax to read a user's name into a variable called username?
Aread > username
Bread -p username
Cread $username
Dread username
Step-by-Step Solution
Solution:
  1. Step 1: Recall basic read syntax

    The correct syntax to store input is read variable_name without any special characters.
  2. Step 2: Check each option

    read username uses read username, which correctly stores input in username. Others misuse flags or symbols.
  3. Final Answer:

    read username -> Option D
  4. Quick Check:

    read variable_name = correct syntax [OK]
Quick Trick: Use read followed by variable name only [OK]
Common Mistakes:
MISTAKES
  • Adding $ before variable in read
  • Using > instead of variable name
  • Misusing -p without prompt text

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes