title: What is the bash script equivalent of ctrl + c in Electron?
body: <p>I've looked all over I'm not sure where I should be looking.  </p>
  
  <p>I want to run a <code>ctrl + c</code> command from bash script that is being called from Electron but it doesn't seem to work.</p>
  
  <p>I've stripped down my code to make it easier to read:</p>
  
  <p>My <code>index.js</code> file</p>
  
  <pre><code>var electron = require("electron");
  var ipc = electron.ipcRenderer;
  var shell = require('electron').shell;
  var remote = require('electron').remote
  var fs = require('fs');
  var path = require('path');
  var spawn = require('child_process').spawn;
  
  function runScript(index) {
      var bashScriptRun = spawn('/bin/sh', [directory/runScript.sh]);
  
      bashScriptRun.stdout.on('data', function (data) {
          console.log(data.toString())
      });
  }
  
  function cancelScript() {
      var cancelBashScript = spawn('/bin/sh', [directory/cancelScript.sh]);
  
      cancelBashScript.stdout.on('data', function (data) {
          console.log(data.toString())
      });
  }
  </code></pre>
  
  <p>The <code>cancelScript.sh</code> file</p>
  
  <pre><code># Get its PID
  PID=$!
  # Wait for 2 seconds
  sleep 2
  # Kill it
  kill $PID
  </code></pre>
  
  <p>The console.log confirms that the script continues running even though <code>cancelScript.sh</code> has been called.<br>
  Also when I try to echo the <code>PID($!)</code> variable, it logs an empty string.</p>
  
  <p>What am I doing wrong? </p>
  
  <p>Any guides on where can I learn bash scripting/SIGINIT/etc for dummies? </p>
  
  <p>I still can't get my head around it or the docs I've found so far.</p>
  
  <p>Thanks, All</p>
  
  <p>Your help is much appreciated  </p>
  
  <p>Moe</p>