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:
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.
Step 2: Identify the unnecessary keyword
The keyword 'def' is used in other languages like Python but is not used in bash function definitions.
Final Answer:
def -> Option A
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
Master "Functions" in Bash Scripting
9 interactive learning modes - each teaches the same concept differently