-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnagit-TechSmith-2023.2.2_Uninstaller.sh
60 lines (49 loc) · 2.01 KB
/
Snagit-TechSmith-2023.2.2_Uninstaller.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
#app_path="/Applications/Snagit 2023.app" # Define the path to the application
LicenseKeyFile="/Users/Shared/TechSmith*" # Define the path to the LicenseKey file
# Function to uninstall an application
uninstall_app() {
local app_name="$1"
# Stop the application if it's running
echo "Checking for application status Snagit $app_name"
# Get the process IDs of the application
app_pids=($(pgrep -f "Snagit $app_name"))
# Check if there are any running processes
#if [[ -${#app_pids[@]} -gt 0 && ${#app_pids[@]} -ne "" ]]; then
if [ ${#app_pids[@]} -gt 0 ]; then
# Terminate all running processes forcefully
for pid in "${app_pids[@]}"; do
kill -9 "$pid"
echo "The application has been forcefully terminated =$pid"
done
else
echo "Application Process not found Snagit $app_name"
fi
sleep 5
echo "Removing the Snagit $app_name LicenseKey file..."
rm -f "$LicenseKeyFile"
# Remove the application and its associated files
rm -rf /Applications/Snagit\ $app_name*
rm -rf /Users/Shared/TechSmith
rm -rf ~/Library/Group\ Containers/*.com.techsmith.snagit
rm -rf ~/Library/Caches/com.techsmith.snagit*
rm -rf ~/Library/Caches/com.TechSmith.Snagit*
rm -rf ~/Library/Logs/TechSmith
rm -rf ~/Library/Preferences/com.TechSmith.Snagit*
rm -rf ~/Library/Preferences/com.techsmith.snagit.capturehelper*
rm -rf ~/Library/Saved\ Application\ State/com.TechSmith.Snagit*
rm -rf ~/Library/WebKit/com.TechSmith.Snagit*
rm -rf ~/Library/HTTPStorages/com.TechSmith.Snagit*
rm -rf ~/Library/Application\ Support/TechSmith
rm -rf ~/Library/Application\ Support/CrashReporter/Snagit*
#Exception
#rm -rf ~/Pictures/Snagit
echo "The $app_name has been uninstalled from your Mac"
echo
}
# List of applications to uninstall
applications=("2023" "2022" "2021")
# Loop through the list and uninstall each application
for app in "${applications[@]}"; do
uninstall_app "$app"
done