I am currently trying to make a bash script that will go into every folder in ./ and compile blah.java, then run blah sending in a number for an input, and put the output in a file that I have named. I have something that is somewhat functional, but it only goes into the first directory, and after that it fails on me. I currently have...
#! /bin/bash
for i in $(find . -maxdepth 1 -type d)
do
pwd
cd $i
pwd
if [ -f "blah.java" ];
then
javac -cp . blah.java
echo "17" | java -cp . blah - > blahresult17
echo "43" | java -cp . blah - > blahresult43
fi
done
I think it is having problems, because it is trying to go into a directory from ./ once it goes into a subdirectory, but obviously from the subdirectory it doesn't exist.