bash - Displaying a script's stdin within Java -


at moment, have java program executes script input.sh external process. script echos line user has entered, added history functionality.

here code input.sh:

#!/bin/sh ifs="" while read -e line     echo $line     history -s $line done 

and here java code program main.java:

public class main {     static public void main(string[] args) {         try {             processbuilder pb = new processbuilder().redirectinput(processbuilder.redirect.inherit);             process script = pb.command("/bin/sh", "-i","input.sh").start();              bufferedreader br = new bufferedreader(new inputstreamreader(script.getinputstream()));             string line = null;             system.out.println("starting");              while ((line = br.readline()) != null) {                 system.out.println(line);             }         }         catch (ioexception e) {         }     } } 

now, when execute ./input.sh in terminal, script behaves should. display user has entered, move cursor when left , right arrow keys pressed (instead of showing ^[[d), pressing , down navigate through entered commands, , pressing enter print user has typed. however, when execute java program, cannot see typing, display results fine.

can tell me why characters showing when inputting java program? thanks


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -