Bird
0
0

What will be the output of this script run in Bash but not in Fish?

medium📝 Command Output Q4 of 15
Bash Scripting - Basics
What will be the output of this script run in Bash but not in Fish?
echo ${BASH_VERSION}
APrints Bash version number
BPrints Fish version number
CPrints nothing
DSyntax error
Step-by-Step Solution
Solution:
  1. Step 1: Understand variable availability

    BASH_VERSION is a special variable set only in Bash shell.
  2. Step 2: Predict output in Fish shell

    Fish does not define BASH_VERSION, so it prints nothing or empty.
  3. Final Answer:

    Prints Bash version number -> Option A
  4. Quick Check:

    BASH_VERSION defined only in Bash = Prints version [OK]
Quick Trick: BASH_VERSION only exists in Bash shell [OK]
Common Mistakes:
MISTAKES
  • Expecting Fish to print Bash version
  • Thinking variable causes error
  • Assuming variable prints Fish version

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes