Bird
0
0

Identify the error in this script snippet:

medium📝 Debug Q6 of 15
Bash Scripting - Variables
Identify the error in this script snippet:
myVar="Hello"
unsetmyVar
echo $myVar
AVariable name is invalid
BEcho command is incorrect
CUnset cannot be used on variables
DMissing space between 'unset' and variable name
Step-by-Step Solution
Solution:
  1. Step 1: Check the unset command syntax

    The command must have a space between unset and the variable name.
  2. Step 2: Identify the error in the snippet

    Here, unsetmyVar is treated as a single command, causing an error.
  3. Final Answer:

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

    Unset syntax requires space [OK]
Quick Trick: Always put space after unset command [OK]
Common Mistakes:
MISTAKES
  • No space after unset
  • Using invalid variable names
  • Misusing echo syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes