Bird
0
0

Identify the error in this script:

medium📝 Debug Q6 of 15
Bash Scripting - User Input
Identify the error in this script:
echo "Enter your city:"
readcity
echo "City is $city"
ANo error, script works fine
BVariable name should be capitalized
Cread command cannot read strings
DMissing space between read and variable name
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of read command

    readcity is treated as a command, not read city.
  2. Step 2: Identify missing space

    There must be a space between read and variable name.
  3. Final Answer:

    Missing space between read and variable name -> Option D
  4. Quick Check:

    read requires space before variable [OK]
Quick Trick: Always put space: read variable [OK]
Common Mistakes:
MISTAKES
  • Writing read and variable as one word
  • Assuming variable case matters here
  • Thinking read can't read strings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes