I'm trying to make an automated compiler to invoke gcj to compile classes in folders recursively. It works OK now, but it spits out these ugly error messages when it hits non-.java files and ignores them.
Is there a way I can run an
if string contains substring "foo", do this in Bash?
compilejava.sh
Code:
#! /bin/bash
#
# $1 is the directory
# $2 is the classpath
function runprocess
{
for myfilename in $1/* ;
do
if test -d $myfilename ; then
echo "Entering $myfilename/"
runprocess $myfilename $2
elif $myfilename contains ".java" ; then
echo "Compiling $myfilename"
gcj -C --classpath=$2 $myfilename
else
echo "Skipping $myfilename"
fi
done
}
runprocess $1 $2
The bolded line of code is the pseudocode for what I want to accomplish.
Any help?