Here is a copy of my current code:
#!/bin/bash list="/Users/ajm/Desktop/170Grading/output/list.txt" score="/Users/ajm/Desktop/170Grading/output/score.txt" echo "" > list echo "" > score find $1 -name '*.java'>> list exec 3<list while IFS='' read -r -u 3 line || [[ -n "$line" ]]; do # read -p "> $line (Press Enter to continue)" echo "the next file is $line" >> score # open -a "Xcode" "$line" ((javac -d "/Users/ajm/Desktop/170Grading/runs" "$line") && (echo compiled >> score)) || ((echo not compiled) >> score) echo "" | cd "/Users/ajm/Desktop/170Grading/runs" java "$line" >> score done
When the students have submitted their files for grading, I downloaded a .zip file from the course website. I unzipped this file to a parent folder on my desktop called
170Grading parent folder, there are two additional sub-folders, these subfolders are called output and runs.
My first goal is to extract the path of every class file in this parent directory
170Grading and add it to a file. Then I would like to compile each .java file to a .class file. Finally I would like to run these .class files with a standard input, and record the output in a text file.
I would like to run each file one at a time so that I can examine the students' code submission, and note any odd choices or places where there is room for improvement.
Currently, the script can, correctly, find all .java files and place them in the file list.txt. The lines:
# read -p "> $line (Press Enter to continue)" echo "the next file is $line" >> score # open -a "Xcode" "$line"
also work correctly. Unfortunately the last two lines of my code are failing to do what I want, and probably need to be revised. The code does not compile correctly, and therefore the last line fails to output anything as well. I recognize that I can't use "$line" in the second to the last lines of my code, because when the code was compiled the path /path/to/this/example.java becomes example.class.