title: How to immediately trap a signal to an interactive Bash shell?
body: <p>I try to send a signal from one terminal A to another terminal B. Both run an <strong>interactive shell</strong>.</p>
  <p>In terminal B, I trap signal SIGUSR1 like so :</p>
  <pre><code>$ trap 'source ~/mycommand' SIGUSR1
  </code></pre>
  <p>Now in terminal A I send a signal like so :</p>
  <pre><code>$ kill -SIGUSR1 pidOfB
  </code></pre>
  <p>Unfortunately, nothing happens in B. If I want to have my command executed, I need to switch to B and either input a new command or press enter.</p>
  <p>How can I avoid this drawback and immediately execute my command instead ?</p>
  <p>EDIT :</p>
  <p>It's important to note that I want to interact directly with the interactive shell in terminal B from terminal A.
  For this reason, every solution where the trap command would be executed in a subshell would not work for me...</p>
  <p>Also, terminal B must stay interactive.</p>