> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bash Ignore Signal

In Bash, ignoring a signal is the process of instructing the shell to discard specific asynchronous POSIX signals (such as `SIGINT` or `SIGTERM`) rather than executing their default disposition. This is achieved using the `trap` builtin command by binding an empty string (`''` or `""`) as the command argument for the target signal.

## Syntax

```bash theme={"dark"}
trap '' SIGNAL_SPEC [SIGNAL_SPEC ...]
```

* **`''` (Empty String):** The exact mechanism that instructs the shell to ignore the signal. Note that if the command argument is omitted but a `SIGNAL_SPEC` is provided (e.g., `trap SIGINT`), Bash resets the signal to its default disposition. To print the current signal handlers, *all* arguments must be omitted (i.e., invoking just `trap` or `trap -p`).
* **`SIGNAL_SPEC`:** The signal to be ignored. This can be the signal name with the `SIG` prefix (e.g., `SIGINT`), the signal name without the prefix (e.g., `INT`), or the numeric signal value (e.g., `2`).

## Implementation Examples

```bash theme={"dark"}

# Ignore SIGINT 
trap '' SIGINT


# Ignore multiple signals simultaneously (SIGTERM and SIGHUP)
trap '' TERM HUP


# Ignore signals using their numeric values
trap '' 2 15
```

## Technical Characteristics

* **Unignorable Signals:** The POSIX standard dictates that `SIGKILL` and `SIGSTOP` cannot be caught, blocked, or ignored. Attempting to trap these in Bash will result in an error.
* **Inheritance of Ignored Signals on Entry:** Per POSIX and Bash rules, signals that are already ignored upon entry to the shell environment cannot be trapped, caught, or reset to their default disposition by the script. Any attempt to change the disposition of a signal that was ignored at startup is silently discarded.
* **Child Process Inheritance:** When a signal is explicitly ignored in a Bash script using `trap '' SIGNAL`, all child processes and subshells spawned by that script will inherit the ignored disposition. This is a distinct behavior compared to trapping a signal with an executable command, which Bash resets to the default disposition upon forking a child process.
* **Restoring Default Disposition:** To stop ignoring a signal and revert it to its default operating system behavior, the `trap` command is invoked with a dash (`-`) as the command argument, or by omitting the command argument entirely.

```bash theme={"dark"}

# Revert SIGINT to its default disposition using a dash
trap - SIGINT


# Revert SIGINT to its default disposition by omitting the command argument
trap SIGINT
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Bash Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
