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:42:43 -0400
commit795b6547be3700f7bdb16205fb36646add9661da (patch)
tree14602e159b216190f4e744978cb75b3575f6d847
parentd28036d704bd077af51dbcbbaa0d0da21aa0591c (diff)
db-functions: Use awk to avoid needless subshell capturelukeshu/to-upstream/2018-03-14-archlinux+cleanup-v2.1
Use ! ... | awk 'a[$0]++>1{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..6170402 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]++>1{exit 1}'; then
error 'Duplicate packages found!'
exit 1
fi