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

20 lines
497 B
Bash
Raw Normal View History

2021-03-03 15:45:33 +01:00
#!/bin/bash
2021-03-09 23:20:28 +01:00
# Clean and compile
2021-03-03 16:32:13 +01:00
rm -f old_file new_file;
echo "QWERTYUIOP" > old_file;
2021-03-09 23:20:28 +01:00
echo "ASDFGHJKLZ" > old_file2;
mkdir new_dir;
2021-03-03 16:32:13 +01:00
gcc -Wall main.c -o cp;
2021-03-09 23:20:28 +01:00
# Run
2021-03-03 16:32:13 +01:00
./cp old_file new_file;
2021-03-09 23:20:28 +01:00
./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;