Merge pull request 'Use the -u option in sort, simplify array $existing_dirs' (#19) from rokosun-patch-1 into main

Reviewed-on: #19
This commit is contained in:
Tio TROM 2022-12-20 21:32:58 +01:00
commit 21b0d7f704

View File

@ -46,7 +46,7 @@ fixfiles() {
mv "$file" "$bakdir/$name.bak" mv "$file" "$bakdir/$name.bak"
done < "$data" 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 for bakfile in "$bakdir"/*.desktop.bak; do
name=$(basename "${bakfile%.bak}") || continue name=$(basename "${bakfile%.bak}") || continue
@ -61,9 +61,8 @@ fixfiles() {
done done
} }
existing_dirs=()
for dir in "$user" "$pacman_global" "$pacman_local" "$flatpak_global" "$flatpak_local" "$snap"; do 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 done
detectfiles detectfiles