Almost similar to this topic, but here I am not a superuser to use --stdin.
So I found an other way round, I would open a "shell" in background and give input to shell via a String
through InputStream
I made a code like below:
String s = "cd bin\n";
byte bb[] = s.getBytes();
InputStream intt = new ByteArrayInputStream(bb);
channel.setInputStream(new FilterInputStream(intt) {
public int read(byte[] b, int off, int len) throws IOException {
return in.read(b, off, (len > 1024 ? 1024 : len));
}
});
Now this works perfectly when I want to execute only one command but I want to give multiple commands, for which I am facing issue.
Any suggestions?
Regards,
Ishan