I want to see the output of a bash script to be printed in my java standard output.
My shell script script01.sh
looks like this:
#!/bin/bash
echo "SQL version is:"
basename $(docker exec sql-container readlink current)
The output for above would be for example:
MyTerminal$> ./script01.sh
SQL version is:
14-2-release01
I want this to be shown in my java standard output. When I run this method, it doesn't print!
private static void printCurrentVersion() throws IOException {
Process p = Runtime.getRuntime().exec(new String[] {"bash", "-c", "./script01.sh"});
System.out.println("Did this # println appear?");
}
However only thing that prints is: Did this # println appear?
Any idea?