I would like to get the output of a shell command, "ls -l" for example using RootTools and pass it to a variable or array so that i can manipulate it.
This is the code that i use but does not work.
final StringBuilder s = new StringBuilder();
final Command command = new Command(0, "ls -l") {
public void commandOutput(int id, String line) {
s.append(line);
super.commandOutput(id, line);
System.out.println(s.toString());
}
};
try {
RootTools.getShell(true).add(command);
} catch (IOException | RootDeniedException | TimeoutException e) {
e.printStackTrace();
}