Bird
0
0

Which keyword is NOT required when defining a function in bash?

easy🧠 Conceptual Q1 of 15
Bash Scripting - Functions
Which keyword is NOT required when defining a function in bash?
Adef
B()
Cfunction
D{}
Step-by-Step Solution
Solution:
  1. Step 1: Understand bash function syntax

    Bash functions can be defined with or without the keyword 'function'. The parentheses '()' and braces '{}' are used to declare and contain the function body.
  2. Step 2: Identify the unnecessary keyword

    The keyword 'def' is used in other languages like Python but is not used in bash function definitions.
  3. Final Answer:

    def -> Option A
  4. Quick Check:

    Keyword not used in bash function definition = def [OK]
Quick Trick: Bash functions don't use 'def' keyword [OK]
Common Mistakes:
MISTAKES
  • Confusing bash with Python syntax
  • Using 'def' in bash function
  • Forgetting braces for function body

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes