Bird
0
0

Why can't the SIGKILL signal be trapped using trap in bash scripts?

hard🧠 Conceptual Q10 of 15
Bash Scripting - Error Handling
Why can't the SIGKILL signal be trapped using trap in bash scripts?
ABecause trap only works with EXIT signal
BBecause SIGKILL is not a real signal
CBecause SIGKILL immediately terminates the process without cleanup
DBecause SIGKILL is blocked by default
Step-by-Step Solution
Solution:
  1. Step 1: Understand SIGKILL behavior

    SIGKILL forcefully stops a process immediately without allowing any cleanup or signal handling.
  2. Step 2: Explain trap limitation

    trap cannot catch SIGKILL because the OS kills the process instantly without running any handlers.
  3. Final Answer:

    Because SIGKILL immediately terminates the process without cleanup -> Option C
  4. Quick Check:

    SIGKILL cannot be trapped due to immediate termination [OK]
Quick Trick: SIGKILL kills instantly; trap can't catch it [OK]
Common Mistakes:
MISTAKES
  • Thinking SIGKILL is not a real signal
  • Believing trap only works with EXIT
  • Assuming SIGKILL is blocked by default

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes