Created
January 10, 2017 15:59
-
-
Save alfhh/90ec76233601ee3177ddece4a424f8a4 to your computer and use it in GitHub Desktop.
Bash file to create, compile and run Java files in one line
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/bash | |
# The name of the file is passed as parameter by $1 | |
ext='.java' | |
file=$1$ext | |
if [ -f $file ]; | |
then | |
javac $file | |
java $1 | |
else | |
# Create the Java File | |
touch $file | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment