title: Permission denied running shell script from Android app
body: <p>I'm trying to run a script from my Android app, the .sh is in /res/raw folder which eventually is copied to internal storage, and rooting the device is not an option.</p>
  
  <p>But I'm facing this error: Error running exec(). Command: [.....] where the cause is java.io.IOException: Permission denied; I've been trying to run the bash for 2 days, but at this point I do not see further, hope someone with fresher mind can see what's missing.</p>
  
  <p>I already tried to run chmod 775 as well</p>
  
  <p>Script (test.sh):</p>
  
  <pre><code>#!/bin/bash
  REQUESTDATE=`date "+%Y-%m-%dT%H:%M:%S"`
  URL=https://.....
  Resp=`curl -v -H "date: $REQUESTDATE" -H "Content-Type: application/json" -X POST -d@my_json.json $URL`
  echo $Resp
  </code></pre>
  
  <p>On my Android app:</p>
  
  <pre><code>private void runCommand(){
          String pathToScript = getDir("my_scripts",Context.MODE_PRIVATE).getAbsolutePath() + File.separator + "test.sh";
          String[] commands = {"bash", "-c", pathToScript};
  
          try{
              java.lang.Process process = new ProcessBuilder()
                      .command(commands)
                      .directory(new File (getDir("my_scripts",Context.MODE_PRIVATE).getAbsolutePath()))
                      .redirectErrorStream(true)
                      .start();
  
              //Read output
              StringBuilder output = new StringBuilder();
  
              BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
              String line = "";
              while ((line = bufferedReader.readLine()) != null){
                  output.append(line + "\n");
              }
  
              if (process.waitFor() == 0){
                  Log.i(TAG, "Success");
              } else{
                  e.printStackTrace();
              } 
          }catch(IOException e){
          e.printStackTrace();
          }catch (Exception e){
              e.printStackTrace();
          }
  }
  </code></pre>