title: Running an interactive shellscript using java
body: <p>I am writing a javacode to call a interactive shellscript and using process builder for calling shellscript. I know that to pass parameters to this shell script i have to take its inputstream to check it's output and need to use output stream to pass command to it. My question is that how would I know using Input Stream that it's  prompting for entering values ?</p>
  
  <p>My code :</p>
  
  <pre><code>  ProcessBuilder pb2=new ProcessBuilder("/home/abhijeet/sample1.sh","--ip="+formobj.getUpFile().getFileName(),"--seqs="+seqs);
  
          script_exec = pb2.start();
  
                  OutputStream in = script_exec.getOutputStream();
  
                  InputStreamReader rd=new InputStreamReader(script_exec.getInputStream());   
  
                  pb2.redirectError();
  
                  BufferedReader reader1 =new BufferedReader(new InputStreamReader(script_exec.getInputStream()));
  
                  StringBuffer out=new StringBuffer();
  
                  String output_line = "";    
  
                    while ((output_line = reader1.readLine())!= null) 
                    {
                             out=out.append(output_line+"/n");
                             System.out.println("val of output_line"+output_line);
  
                             //---&gt; i need code here to check that whether script is prompting for taking input ,so i can pass it values using output stream
  
                    }
  </code></pre>
  
  <p>Is there any  way to know directly that script is waiting for an input from user?  </p>