From 1b93906376a6ca166d2c158af000348db519671a Mon Sep 17 00:00:00 2001 From: rokosun Date: Wed, 14 Dec 2022 13:37:20 +0100 Subject: [PATCH] Use the -u option in sort, simplify array $existing_dirs --- bin/periodic/fix-zombie-appicons | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/periodic/fix-zombie-appicons b/bin/periodic/fix-zombie-appicons index 0a8bbf0..f0bb5b6 100755 --- a/bin/periodic/fix-zombie-appicons +++ b/bin/periodic/fix-zombie-appicons @@ -46,7 +46,7 @@ fixfiles() { mv "$file" "$bakdir/$name.bak" done < "$data" - [ "$copied" = 'true' ] && [ "$(stat -c '%Y' "$data")" = "$lastmod" ] && sort "$tmp" | uniq > "$data" + [ "$copied" = 'true' ] && [ "$(stat -c '%Y' "$data")" = "$lastmod" ] && sort -u "$tmp" > "$data" for bakfile in "$bakdir"/*.desktop.bak; do name=$(basename "${bakfile%.bak}") || continue @@ -61,9 +61,8 @@ fixfiles() { done } -existing_dirs=() for dir in "$user" "$pacman_global" "$pacman_local" "$flatpak_global" "$flatpak_local" "$snap"; do - [ -d "$dir" ] && existing_dirs=("${existing_dirs[@]}" "$dir") + [ -d "$dir" ] && existing_dirs+=("$dir") done detectfiles -- 2.30.2