Bird
0
0

Which of the following read -p command usages will cause a syntax error in bash?

easy📝 Syntax Q3 of 15
Bash Scripting - User Input
Which of the following read -p command usages will cause a syntax error in bash?
Aread -p "Enter value: " value
Bread -p "Enter value:" value
Cread -p 'Enter value: ' value
Dread -p Enter value: value
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax for read -p

    The prompt string must be enclosed in quotes (single or double).
  2. Step 2: Analyze each option

    read -p Enter value: value lacks quotes around the prompt string, causing a syntax error.
  3. Final Answer:

    read -p Enter value: value -> Option D
  4. Quick Check:

    Prompt string must be quoted [OK]
Quick Trick: Always quote prompt string in read -p [OK]
Common Mistakes:
MISTAKES
  • Omitting quotes around prompt text
  • Using unescaped special characters in prompt
  • Placing variable before prompt string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes