Bird
0
0

In Bash scripting, how do you call a function named greet?

easy🧠 Conceptual Q11 of 15
Bash Scripting - Functions
In Bash scripting, how do you call a function named greet?
AWrite <code>greet()</code> with parentheses.
BWrite <code>call greet()</code>.
CJust write <code>greet</code> on a line by itself.
DWrite <code>run greet</code>.
Step-by-Step Solution
Solution:
  1. Step 1: Understand Bash function call syntax

    In Bash, functions are called by simply writing their name without parentheses or keywords.
  2. Step 2: Compare options with Bash syntax

    Only Just write greet on a line by itself. matches the correct way: just the function name alone.
  3. Final Answer:

    Just write greet on a line by itself. -> Option C
  4. Quick Check:

    Function call = function name alone [OK]
Quick Trick: Call functions by name only, no parentheses needed [OK]
Common Mistakes:
MISTAKES
  • Adding parentheses like in other languages
  • Using keywords like 'call' or 'run'
  • Forgetting to write the function name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes