Bird
0
0

Which of the following correctly prints the value of the variable name in bash?

easy📝 Syntax Q12 of 15
Bash Scripting - Variables
Which of the following correctly prints the value of the variable name in bash?
Aecho name
Becho $name
Cecho &name
Decho %name
Step-by-Step Solution
Solution:
  1. Step 1: Recall how to access variable values in bash

    Use the dollar sign ($) before the variable name to get its value.
  2. Step 2: Evaluate each option

    echo $name uses $name correctly. echo name prints the literal word 'name'. The other options use invalid symbols.
  3. Final Answer:

    echo $name -> Option B
  4. Quick Check:

    Use $ to access variable value [OK]
Quick Trick: Use $ before variable to print its value [OK]
Common Mistakes:
MISTAKES
  • Forgetting $ prints variable name, not value
  • Using wrong symbols like & or %
  • Confusing variable access with assignment

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes