Bird
0
0

Find the error in this script:

medium📝 Debug Q7 of 15
Bash Scripting - Basics
Find the error in this script:
#!/bin/bash
echo "Enter your name:"
read name
echo "Hello $Name"
AVariable name is case-sensitive; $Name should be $name
BMissing semicolon after read command
Cread command is invalid without -p option
Decho syntax is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Check variable usage

    Variable names in Bash are case-sensitive; name and Name differ.
  2. Step 2: Identify error in echo

    Using $Name will be empty if not set; should use $name.
  3. Final Answer:

    Variable name is case-sensitive; $Name should be $name -> Option A
  4. Quick Check:

    Variable names are case-sensitive [OK]
Quick Trick: Variable names in Bash are case-sensitive [OK]
Common Mistakes:
MISTAKES
  • Ignoring case sensitivity
  • Adding unnecessary semicolons
  • Misusing read command options

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes