I know csh is bad, but required for this job. Anyway, I'm trying to write a program to evaluate a set of student sets in a directory called dropbox:
#!/bin/csh
foreach directory (`ls dropbox`)
if( ! -e dropbox/$directory/calculator ) then
mkdir dropbox/$directory/calculator
touch dropbox/$directory/calculator/comments
echo "Directory did not exist and was created automatically" > dropbox/$directory/calculator/comments
else
touch dropbox/$directory/calculator/comments
if( ! -e dropbox/$directory/calculator/calc.csh ) then
echo "No submission from $directory at `date`" > dropbox/$directory/calculator/comments
else if( ! -x dropbox/$directory/calculator/calc.csh ) then
echo "Script not executable: -5 points" > dropbox/$directory/calculator/comments
else
touch dropbox/$directory/calculator/results
echo "Results for $directory calculator script:" >
dropbox/$directory/calculator/calc.csh /afs/nd.edu/coursesp.14/cse/cse20189.01/files/hw5/calc > dropbox/$directory/calculator/results
echo "Testing complete for $directory" > dropbox/$directory/calculator/results
endif
endif
end
Results for ls dropbox(All directories):
betty charles frank izzy lisa ophelia rosie uhura xena
bill don george jackie mark paul sandy victor yarek
bob erin hiram kathy nancy quentin tom wally zela
When I run the script, it returns a message stating that the directory is not declared. Any tips?
source
share