EX200 Create simple shell scripts Practice Question
A complex script uses 'trap' to handle signals. The admin writes 'trap '' SIGINT' to ignore Ctrl+C, but later in the script they want to re-enable the default behavior. Which command restores the default behavior for SIGINT?
⚠ Common exam trap
The RHCSA exam often tests the subtle distinction between `trap '' signal` (ignore) and `trap - signal` (restore default), where candidates mistakenly think `trap signal` or `trap : signal` resets the handler.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
trap - SIGINT
`trap - SIGINT` resets the signal handler for SIGINT to its default behavior. The `trap '' SIGINT` command sets an empty action, which ignores the signal; using `trap - signal` removes that custom handler and restores the default action (typically terminating the process).
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
trap - SIGINT
Why this is correct
trap - SIGINT resets SIGINT to its default disposition, undoing the earlier ignore. The hyphen tells the shell to restore default handling rather than run a command, which is exactly the re-enable behaviour the script needs after ignoring Ctrl+C.
- ✗
trap : SIGINT
Why it's wrong here
A colon is a valid shell builtin that does nothing, so this installs a no-op handler rather than clearing the trap. It is tempting because ':' is used as a placeholder command, but it leaves SIGINT ignored, whereas the correct syntax omits the action entirely to restore default.
- ✗
trap 2
Why it's wrong here
Passing the bare number 2 sets the handler to run the shell command named '2', not restore SIGINT's default disposition. It is tempting because signal numbers identify signals, but restoring default requires the signal name with no action argument, which resets the trap.
- ✗
trap SIGINT
Why it's wrong here
Supplying only the signal name with no action argument resets the trap, but 'trap SIGINT' is not valid syntax for that reset; the shell expects the action first, then the signal. It is tempting because it names the right signal, yet the argument order is reversed.
Go deeper
Related to this question
About these practice questions
This EX200 question is part of Courseiva's 427-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This EX200 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX200 exam.