My goal is to execute a personalized prompt in a bash shell in linux and to execute orders. The result should be like in the image.
So I suppose I should start with something like:
ProcessBuilder builder = new ProcessBuilder();
builder.command("sh");
builder.directory(new File(System.getProperty("user.home")));
Process process = builder.start();
or
String homeDirectory = System.getProperty("user.home");
Process process;
try {
System.out.print("# MyShell> ");
process = Runtime.getRuntime().exec(String.format("sh", homeDirectory));
} catch (IOException e) {
System.err.println("Error en el método exec()");
e.printStackTrace();
}
Controlling the exceptions.
So basically is to start a personalized functional bash prompt in java and control the error messages (like changing its color). Also controlling the exit with a personalized word, like 'quit' instead of 'exit'.
Note: I am not trying to execute a script or some commands like 'tree' or 'ls' like in many other examples around here. I'm looking for a way to run my personalized bash and do everything that the system allows me in bash or close to this idea.