Skip to content

Instantly share code, notes, and snippets.

@FarisR99
Last active August 29, 2015 14:04
Show Gist options
  • Save FarisR99/ff75f8d5b1a3e0556586 to your computer and use it in GitHub Desktop.
Save FarisR99/ff75f8d5b1a3e0556586 to your computer and use it in GitHub Desktop.
OPMCSGBot
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
public class ReadScript {
public static void main(String[] args) {
new ReadScript();
}
public ReadScript() {
File parentDir = new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile();
if (parentDir != null) {
File startScript = new File(parentDir, "start_bot.sh");
if (startScript.exists()) {
try (BufferedReader br = new BufferedReader(new FileReader(startScript))) {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
sb.append(System.lineSeparator());
line = br.readLine();
}
System.out.println(sb.toString());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment