I'm trying to run a bash script file in Java program and I'm using this way:
Runtime rt = Runtime.getRuntime();
try {
Process proc = rt.exec("THE PATH FILE");
BufferedReaderinput=newBufferedReader(newInputStreamReader(proc.getInputStream()));
String line=null;
while((line=input.readLine()) != null) {
System.out.println(line);
}
} catch (IOException ex) {
System.out.println(ex.toString());
}
but I'm using an input in my bash script as $1 when I'm running it from command line and I want to use it in my Java program to take the correct output . How can I do this in my Java program?