forked from Homebrew/homebrew-cask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist_recent_pkg_ids
executable file
·46 lines (34 loc) · 952 Bytes
/
list_recent_pkg_ids
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
#!/bin/bash
#
# list_recent_pkg_ids
#
###
### settings
###
set -e # exit on any uncaught error
set +o histexpand # don't expand history expressions
shopt -s nocasematch # case-insensitive regular expressions
###
### main
###
_list_recent_pkg_ids () {
/bin/ls -t /var/db/receipts | \
/usr/bin/egrep '\.plist$' | \
/usr/bin/perl -pe 's{\A([^/]+)\.plist\Z}{$1}sg' | \
/usr/bin/egrep -v '^com\.apple\.' | \
/usr/bin/head -10
}
# process args
if [[ $1 =~ ^-+h(elp)?$ ]]; then
printf "list_recent_pkg_ids
Print pkg receipt IDs for the 10 most-recently-installed packages,
which may be useful in a Cask uninstall stanza, eg
uninstall pkgutil: 'pkg.receipt.id.goes.here'
Package IDs attributed to Apple are excluded from the output.
See CONTRIBUTING.md for more information.
"
exit
fi
# dispatch main
_list_recent_pkg_ids "${@}"
#