title: Objective-C system("echo ... > ...") not writing to file
body: <p>I am trying to execute the following:</p>
  
  <pre><code>system("if [[ ${?} == 0 ]]; then echo '0' &gt; /var/mobile/CCC/STATUS.txt; else echo '1' &gt;&gt; /var/mobile/CCC/STATUS.txt; fi");
  </code></pre>
  
  <p>However, upon <code>SSH</code>-ing into my iPhone, there is no <code>/var/mobile/CCC/STATUS.txt</code> file.</p>
  
  <p>The weird thing about this is that I have another <code>system()</code>, which also uses <code>echo</code> to insert information into a file:</p>
  
  <pre><code>system("(for i in $(echo \"10.0.0.\"{1..255}); do (&lt;/dev/tcp/${i}/8008) &amp;&gt; /dev/null &amp;&amp; if [[ ${?} == 0 ]]; then echo \"${i}\" &gt;&gt; /var/mobile/CCC/HOSTS.txt; fi &amp; done)");
  </code></pre>
  
  <p>Which works fine!!</p>
  
  <p>I have tried placing the </p>
  
  <pre><code>system("if [[ ${?} == 0 ]]; then echo '0' &gt; /var/mobile/CCC/STATUS.txt; else echo '1' &gt;&gt; /var/mobile/CCC/STATUS.txt; fi");
  </code></pre>
  
  <p>line both before and after the</p>
  
  <pre><code>system("(for i in $(echo \"10.0.0.\"{1..255}); do (&lt;/dev/tcp/${i}/8008) &amp;&gt; /dev/null &amp;&amp; if [[ ${?} == 0 ]]; then echo \"${i}\" &gt;&gt; /var/mobile/CCC/HOSTS.txt; fi &amp; done)");
  </code></pre>
  
  <p>line, but there is a <code>/var/mobile/CCC/HOSTS.txt</code> file, but no <code>/var/mobile/CCC/STATUS.txt</code> file.</p>
  
  <p>Why is this?</p>
  
  <p>EDIT:</p>
  
  <p>These codes are in my</p>
  
  <pre><code>-(void) viewDidLoad
  </code></pre>
  
  <p>method, so upon opening my app, they are automatically executed.</p>
  
  <p>EDIT 2:</p>
  
  <p>After <code>SSH</code>-ing into my iPhone, running this command:</p>
  
  <pre><code>echo commandSuccessfull &amp;&amp; if [[ ${?} == 0 ]]; then echo '0' &gt; /var/mobile/CCC/STATUS.txt; else echo '0' &gt; /var/mobile/CCC/STATUS.txt; fi
  </code></pre>
  
  <p>Does work, and produces a <code>/var/mobile/CCC/STATUS.txt</code> file, with the contents in hex: <code>300a</code> (<code>0\n</code>)</p>