Last active
August 29, 2015 14:04
-
-
Save FarisR99/ff75f8d5b1a3e0556586 to your computer and use it in GitHub Desktop.
OPMCSGBot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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