title: Sublime Text 3 compile and run (in terminal) C on OS X with passed arguments
body: <p>I'm trying to compile a C program in Sublime Text 3 then run it in the terminal (which opens up through Sublime Text) on OS X Yosemite. My build system is:</p>
  
  <pre><code>{
      "cmd": ["gcc", "${file}", "-o", "${file_path}/${file_base_name}"],
      "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
      "working_dir": "${file_path}",
      "selector": "source.c",
  
      "variants":
      [
          {
          "name": "Run",
          "cmd": ["bash", "-c", "gcc '${file}' -o '${file_path}/${file_base_name}' &amp;&amp; '${file_path}/${file_base_name}'"]
          }
      ]
  }
  </code></pre>
  
  <p>When I build, for example, <code>test.c</code>, it compiles fine. When I run the program I get this: <code>bash: line 1: 916 Segmentation fault: 11</code>. I'm sure this is because my program needs arguments passed to it. </p>
  
  <p>So I have two questions:</p>
  
  <ol>
  <li><p>How can I change the build system so that when I run it, it opens up the terminal and runs in there? </p></li>
  <li><p>How do I pass arguments to the program before it runs? For example, on Linux I would type <code>./test hello 20932aa</code> and it will run fine. How can I achieve the same on Sublime Text 3 (OS X Yosemite).</p></li>
  </ol>