CS计算机代考程序代写 #!/bin/bash

#!/bin/bash
cd /home/codio/workspace/tests

# make sure source code exists
. ./files-validation.cfg
FILES_ALLOWED=$(echo “${ALLOWED_FILE_TYPES}” | tr -d ‘[:space:]’)
VALIDATION_SUCCESSFULL=”0″
for file_allowed in $(echo “${FILES_ALLOWED}” | sed -n 1’p’ | tr ‘,’ ‘\n’); do
if [ ! -f “../${file_allowed}” ]; then
echo “Could not find ${file_allowed}, please check if you have uploaded your files”
VALIDATION_SUCCESSFULL=”1″
fi
done
if [ “${VALIDATION_SUCCESSFULL}” -eq “1” ]; then
echo “You have missing files, please check if you have uploaded everything that was required”
exit 1
fi

echo “No files are missing.”
echo “______________________”
echo

# test compile all .c files
cd /home/codio/workspace
for file_allowed in $(echo “${FILES_ALLOWED}” | sed -n 1’p’ | tr ‘,’ ‘\n’); do
if [[ $file_allowed == *.c ]]; then
file_name=”$(cut -d’/’ -f2 <<<$file_allowed)" if clang -c $file_allowed; then echo "$file_name - Compile successful." rm "$(cut -d'.' -f1 <<<$file_name)"".o" else echo "$file_name - Failed to compile!" fi fi done echo