title: Performing multiple executions on Runtime exec
body: <p>I'm trying to do this simple unix ls in Android:</p>
  
  <pre><code>cd /data
  </code></pre>
  
  <p>then</p>
  
  <pre><code>ls
  </code></pre>
  
  <p>It should return all the content of /data folder.</p>
  
  <p>I've this coded:</p>
  
  <pre><code>try {
         String line;
         Process p = Runtime.getRuntime().exec(new String[] { "ls /data"});
         BufferedReader in = new BufferedReader(
                 new InputStreamReader(p.getInputStream()) );
         while ((line = in.readLine()) != null) {
           Log.d("debugging", line);
         }
         in.close();
       }
       catch (Exception e) {
         e.printStackTrace();
       }
  </code></pre>
  
  <p>The problem I'm facing at the moment, is that I can't do more than a single command at once. For example, if I write <code>ls /data</code> its returning nothing. It seems that he doesn't like spaces.</p>
  
  <p>Everything works if I just write a single word like "ls" which is returning the list of root directory:</p>
  
  <pre><code>03-19 22:51:59.241: D/debugging(16274): acct
  03-19 22:51:59.241: D/debugging(16274): cache
  03-19 22:51:59.241: D/debugging(16274): config
  03-19 22:51:59.241: D/debugging(16274): crashtag
  03-19 22:51:59.241: D/debugging(16274): d
  03-19 22:51:59.241: D/debugging(16274): data
  03-19 22:51:59.241: D/debugging(16274): default.prop
  03-19 22:51:59.241: D/debugging(16274): dev
  03-19 22:51:59.241: D/debugging(16274): etc
  03-19 22:51:59.241: D/debugging(16274): fstab
  03-19 22:51:59.241: D/debugging(16274): init
  03-19 22:51:59.241: D/debugging(16274): init.clrdex.sh
  03-19 22:51:59.241: D/debugging(16274): init.goldfish.rc
  03-19 22:51:59.241: D/debugging(16274): init.hostapd.sh
  03-19 22:51:59.241: D/debugging(16274): init.rc
  03-19 22:51:59.241: D/debugging(16274): init.semc.rc
  03-19 22:51:59.241: D/debugging(16274): init.usbmode.sh
  03-19 22:51:59.241: D/debugging(16274): logo.rle
  03-19 22:51:59.241: D/debugging(16274): mnt
  03-19 22:51:59.241: D/debugging(16274): mr.log
  03-19 22:51:59.241: D/debugging(16274): proc
  03-19 22:51:59.241: D/debugging(16274): root
  03-19 22:51:59.241: D/debugging(16274): sbin
  03-19 22:51:59.241: D/debugging(16274): sdcard
  03-19 22:51:59.241: D/debugging(16274): sys
  03-19 22:51:59.241: D/debugging(16274): system
  03-19 22:51:59.241: D/debugging(16274): ueventd.goldfish.rc
  03-19 22:51:59.241: D/debugging(16274): ueventd.rc
  03-19 22:51:59.241: D/debugging(16274): ueventd.semc.rc
  03-19 22:51:59.241: D/debugging(16274): vendor
  </code></pre>
  
  <p>I've tried as someone mentioned, to fill that array with multiple commands, but its returning nothing. Blank.</p>
  
  <pre><code>{"ls","ls"} //this should return twice ls result.
  </code></pre>
  
  <p><strong>Any ideas how can I "concatenate" a command in Android Runtime?</strong></p>