Last active
December 21, 2015 08:09
-
-
Save IQAndreas/6276512 to your computer and use it in GitHub Desktop.
Want to run Shell/Bash commands but are sick and tired of how sickeningly untyped they are? Introducing JavaSH!
This file contains hidden or 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
#!/bin/javash | |
# Both Bash and Java comments supported (not a feature, I was just too lazy to force one or the other) | |
// Some basic commands are included | |
echo("Hello world!"); | |
// Others, you have to manually run | |
String currentDir = run("pwd"); | |
echo(currentDir); | |
/* Note that you also have full access the Java libraries! */ | |
// Alternatively, modules allow for adding "typed" commands like these | |
git.init(); | |
file.touch("log"); | |
file.chmod("777", "log"); | |
Date date = new Date(); | |
file.append("log", "Logged in " + date.toString()); | |
git.add("log"); | |
echo(git.status()); | |
git.commit("Updated log file"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So long as you have
javac
installed, the library allows for the execution of code directly from the terminal (debating whether to use.javash
extension to avoid confusion):Or