summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2018-03-14 01:19:24 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2018-03-14 01:29:53 -0400
commitbb337fdce387144a4beb68ad43a8ea4c590e686e (patch)
tree4aeed0787ebba0257608aa78c22f489a1902e731
parentd28036d704bd077af51dbcbbaa0d0da21aa0591c (diff)
db-functions: Use awk to avoid needless subshell capturelukeshu/to-upstream/2018-03-14-archlinux+cleanup-v2
Use ... | awk 'a[$0]++{exit 1}' instead of [[ -n "$(... | sort | uniq -D)" ]] Thanks to Eli Schwartz for suggesting this.
-rw-r--r--db-functions2
1 files changed, 1 insertions, 1 deletions
diff --git a/db-functions b/db-functions
index 9b17e93..8b11f60 100644
--- a/db-functions
+++ b/db-functions
@@ -282,7 +282,7 @@ getpkgfile() {
getpkgfiles() {
local f files
- if [[ ! -z "$(printf '%s\n' "${@%\.*}" | sort | uniq -D)" ]]; then
+ if printf '%s\n' "${@%\.*}" | awk 'a[$0]++{exit 1}'; then
error 'Duplicate packages found!'
exit 1
fi