public static void execShell(String shell){
try {
Process process = null;
List<String> processResult = new ArrayList<String>();
process = Runtime.getRuntime().exec(shell);
BufferedReader input = new BufferedRead(new InputStreamReader(process.getInputStream());
String line = "";
while((line = input.readLine()) != null){
processResult.add(line);
}
} catch (Exception e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void execShellBin(String shell){
try {
Process process = null;
List<String> processResult = new ArrayList<String>();
process = Runtime.getRuntime().exec(new String[]{"/bin/sh","-c",shell},null,null);
BufferedReader input = new BufferedRead(new InputStreamReader(process.getInputStream());
String line = "";
while((line = input.readLine()) != null){
processResult.add(line);
}
} catch (Exception e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static List<String> runShell(String shStr) {
List<String> strList = new ArrayList<String>();
try {
Process process = Runtime.getRuntime().exec(new String[]{"/bin/sh","-c",shStr},null,null);
InputStreamReader ir = new InputStreamReader(process.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
String line;
process.waitFor();
while ((line = input.readLine()) != null){
strList.add(line);
}
} catch (Exception e) {
e.printStackTrace();
}
return strList;
}