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

2 years ago
2 years ago
  1. trap 'echo "Interrupted";
  2. rm main;
  3. cp employeeLogin.c.bak employeeLogin.c;
  4. cp mainMenu.c.bak mainMenu.c;
  5. cp createEmployeeAccount.c.bak createEmployeeAccount.c;
  6. rm employeeLogin.c.bak;
  7. rm mainMenu.c.bak;
  8. rm createEmployeeAccount.c.bak;
  9. cd ..;
  10. rm -r build; exit' SIGINT
  11. clear
  12. ceedling test:all
  13. cd src/
  14. sed '/John Doe/,$d' employeesCredentialsList.txt > temp.txt
  15. mv temp.txt employeesCredentialsList.txt
  16. # backup files
  17. for file in employeeLogin.c mainMenu.c createEmployeeAccount.c; do
  18. cp "$file" "$file.bak"
  19. done
  20. # replace .c with .h in respective files
  21. sed -i 's/createEmployeeAccount.c/createEmployeeAccount.h/g' mainMenu.c
  22. sed -i 's/showGeneralInfoEmployee.c/showGeneralInfoEmployee.h/g' employeeLogin.c
  23. sed -i 's/mainMenu.c/mainMenu.h/g' employeeLogin.c
  24. sed -i 's/employeeLogin.c/employeeLogin.h/g' createEmployeeAccount.c
  25. # remove 'src/'
  26. for file in employeeLogin.c createEmployeeAccount.c; do
  27. sed -i 's/src\///g' "$file"
  28. done
  29. # compile and run program
  30. gcc main.c mainMenu.c employeeLogin.c showGeneralInfoEmployee.c createEmployeeAccount.c -o main
  31. ./main
  32. rm main
  33. # restore backups
  34. for file in employeeLogin.c mainMenu.c createEmployeeAccount.c; do
  35. cp "$file.bak" "$file"
  36. done
  37. # remove backups
  38. for file in employeeLogin.c.bak mainMenu.c.bak createEmployeeAccount.c.bak; do
  39. rm "$file"
  40. done
  41. cd ..
  42. rm -r build/