-
Notifications
You must be signed in to change notification settings - Fork 0
/
rm-apps.sh
executable file
·57 lines (40 loc) · 1.19 KB
/
rm-apps.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
#!/bin/bash
# author: Jon Christensen, date: 2018-10-18, macOS: 10.14, GitHub / Jamf Nation: jychri
# summary: all $apps are closed, then deleted
# --- set value(s) here --- #
apps=(
Keynote
Numbers
Pages
)
# --- do not edit below --- #
# exit early if application is open
# function exitIfOpen() {
# local check; check=$(pgrep -f "$1")
# if [ "$check" != "" ]; then
# echo "exitIfOpen [exit1] $1 is open."; exit 1
# fi
# }
# function rmApp() {
# local path_to_application; path_to_application="/Applications/$1.app"
# if [ ! -d "$path_to_application" ]; then
# echo "rmApplication => [return] No app at $path_to_application, nothing to remove"
# return
# fi
# echo "rmApplication: Removing '$1' at '$path_to_application'"
# /bin/rm -rf "$path_to_application"
# if [ ! -d "$path_to_application" ]; then
# echo "rmApplication: Removed '$1' from '$path_to_application'"
# fi
# }
# --- main! --- #
# comment or uncomment as needed
# quit if any target applications are running
for app in "${apps[@]}"; do
exitIfOpen "$app"
done
# close if any of the target applications are running
# remove target application
for app in "${apps[@]}"; do
rmApp "$app"
done