Bird
0
0

Which keyword is used to specify the alternative commands when the if condition is false in bash?

easy🧠 Conceptual Q2 of 15
Bash Scripting - Conditionals
Which keyword is used to specify the alternative commands when the if condition is false in bash?
Athen
Belif
Cfi
Delse
Step-by-Step Solution
Solution:
  1. Step 1: Identify the role of keywords in if-then-else

    The keyword else is used to run commands when the if condition is false.
  2. Step 2: Differentiate from other keywords

    then starts the true block, elif adds another condition, and fi ends the if statement.
  3. Final Answer:

    else -> Option D
  4. Quick Check:

    Alternative commands keyword = else [OK]
Quick Trick: Use else for the 'otherwise' part of if-then-else [OK]
Common Mistakes:
MISTAKES
  • Using then instead of else
  • Confusing elif with else
  • Forgetting to close with fi

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes