Skip to content

Instantly share code, notes, and snippets.

@alfhh
Created January 10, 2017 15:59
Show Gist options
  • Save alfhh/90ec76233601ee3177ddece4a424f8a4 to your computer and use it in GitHub Desktop.
Save alfhh/90ec76233601ee3177ddece4a424f8a4 to your computer and use it in GitHub Desktop.
Bash file to create, compile and run Java files in one line
#!/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