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.

55 lines
1.4 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. sed '/Name : John/,$d' employeesData.txt > temp.txt
  17. mv temp.txt employeesData.txt
  18. # backup files
  19. for file in employeeLogin.c mainMenu.c createEmployeeAccount.c; do
  20. cp "$file" "$file.bak"
  21. done
  22. # replace .c with .h in respective files
  23. sed -i 's/createEmployeeAccount.c/createEmployeeAccount.h/g' mainMenu.c
  24. sed -i 's/showGeneralInfoEmployee.c/showGeneralInfoEmployee.h/g' employeeLogin.c
  25. sed -i 's/mainMenu.c/mainMenu.h/g' employeeLogin.c
  26. sed -i 's/employeeLogin.c/employeeLogin.h/g' createEmployeeAccount.c
  27. # remove 'src/'
  28. for file in employeeLogin.c createEmployeeAccount.c; do
  29. sed -i 's/src\///g' "$file"
  30. done
  31. # compile and run program
  32. gcc main.c mainMenu.c employeeLogin.c showGeneralInfoEmployee.c createEmployeeAccount.c -o main
  33. ./main
  34. rm main
  35. # restore backups
  36. for file in employeeLogin.c mainMenu.c createEmployeeAccount.c; do
  37. cp "$file.bak" "$file"
  38. done
  39. # remove backups
  40. for file in employeeLogin.c.bak mainMenu.c.bak createEmployeeAccount.c.bak; do
  41. rm "$file"
  42. done
  43. cd ..
  44. rm -r build/