Created
February 24, 2015 23:57
-
-
Save zmarvel/7d7ca19d0142bc9ed7bc to your computer and use it in GitHub Desktop.
Find all java classes from the current directory and execute them
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
#!/bin/bash | |
DIR=$( pwd ) | |
CLASSES=$( find -name '*.class' -print ) | |
for file in $CLASSES; do | |
filedir=$( dirname $file ) | |
filename=$( basename $file | sed s/.class// ) | |
echo Changing to $filedir | |
cd $filedir | |
echo Executing $filename | |
java $filename | |
echo Changing back to $DIR | |
cd $DIR | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment