You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

51 lines
1.3 KiB

trap 'echo "Interrupted";
rm main;
cp employeeLogin.c.bak employeeLogin.c;
cp mainMenu.c.bak mainMenu.c;
cp createEmployeeAccount.c.bak createEmployeeAccount.c;
rm employeeLogin.c.bak;
rm mainMenu.c.bak;
rm createEmployeeAccount.c.bak;
cd ..;
rm -r build; exit' SIGINT
clear
ceedling test:all
cd src/
sed '/John Doe/,$d' employeesCredentialsList.txt > temp.txt
mv temp.txt employeesCredentialsList.txt
# backup files
for file in employeeLogin.c mainMenu.c createEmployeeAccount.c; do
cp "$file" "$file.bak"
done
# replace .c with .h in respective files
sed -i 's/createEmployeeAccount.c/createEmployeeAccount.h/g' mainMenu.c
sed -i 's/showGeneralInfoEmployee.c/showGeneralInfoEmployee.h/g' employeeLogin.c
sed -i 's/mainMenu.c/mainMenu.h/g' employeeLogin.c
sed -i 's/employeeLogin.c/employeeLogin.h/g' createEmployeeAccount.c
# remove 'src/'
for file in employeeLogin.c createEmployeeAccount.c; do
sed -i 's/src\///g' "$file"
done
# compile and run program
gcc main.c mainMenu.c employeeLogin.c showGeneralInfoEmployee.c createEmployeeAccount.c -o main
./main
rm main
# restore backups
for file in employeeLogin.c mainMenu.c createEmployeeAccount.c; do
cp "$file.bak" "$file"
done
# remove backups
for file in employeeLogin.c.bak mainMenu.c.bak createEmployeeAccount.c.bak; do
rm "$file"
done
cd ..
rm -r build/