2016-08-20 01:21:44 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-05-21 09:07:31 +08:00
|
|
|
readonly program="$(basename "${0}")"
|
2016-08-20 01:21:44 +08:00
|
|
|
|
2019-05-21 09:07:31 +08:00
|
|
|
function usage {
|
|
|
|
echo "
|
|
|
|
List pkg receipt IDs for the 10 most recently installed packages. Package IDs attributed to Apple are excluded from the output.
|
2016-08-20 01:21:44 +08:00
|
|
|
|
2019-05-21 09:07:31 +08:00
|
|
|
Usage:
|
|
|
|
${program} [options]
|
2016-08-20 01:21:44 +08:00
|
|
|
|
2019-05-21 09:07:31 +08:00
|
|
|
Options:
|
|
|
|
-h, --help Show this message.
|
|
|
|
" | sed -E 's/ {4}//'
|
2016-08-20 01:21:44 +08:00
|
|
|
}
|
|
|
|
|
2019-05-21 09:07:31 +08:00
|
|
|
if [[ "${1}" =~ ^(-h|--help)$ ]]; then
|
|
|
|
usage
|
|
|
|
exit 0
|
2016-08-20 01:21:44 +08:00
|
|
|
fi
|
|
|
|
|
2019-05-21 09:07:31 +08:00
|
|
|
/bin/ls -t /var/db/receipts | \
|
|
|
|
/usr/bin/grep '\.plist$' | \
|
|
|
|
/usr/bin/grep --invert-match '^com\.apple\.' | \
|
|
|
|
/usr/bin/sed 's/\.plist$//' | \
|
|
|
|
/usr/bin/head -10
|