AAE-CNAS-Labs/Topic-2-Warmup/test.sh

20 lines
497 B
Bash
Executable File

#!/bin/bash
# Clean and compile
rm -f old_file new_file;
echo "QWERTYUIOP" > old_file;
echo "ASDFGHJKLZ" > old_file2;
mkdir new_dir;
gcc -Wall main.c -o cp;
# Run
./cp old_file new_file;
./cp old_file old_file2 new_dir;
tree;
# Check if everything went well
if diff old_file new_file; diff old_file new_dir/old_file; diff old_file2 new_dir/old_file2; then
echo "Well done!"
else
echo "Something went wrong!"
fi
# Clean
rm -f old_file new_file new_dir/old_file new_dir/old_file2;
rmdir new_dir;