I have got this requirement where I need to execute a list of unix commands and then against each command I should store its result. Eg. Commands - cd dir1, pwd, ls
My output should contain -
cd dir1- pwd-dir1 ls-a, b, c, d(assume these are present under dir1 directory)
I tried using JSch library and tried using shell and exec channel types.
But this does not allow me to send a command and read output and then send another and read output.
What I did as of now is Using exec send all the commands and an echo command after each command and then read till that echo for that command output.
Using shell I sent commands but it waits for an exit command other wise it goes to infinite wait.
Also how can we get the error for individual commands
Please suggest if there is any way to achieve this.