Skip to content

Commit 79ca043

Browse files
scopakinomyoga
andauthored
fix(xdg-mime): nounset and IFS fixes
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
1 parent 4fc5c89 commit 79ca043

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

completions/xdg-mime

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ _xdg_mime_mimetype()
99
command cd "$d" 2>/dev/null || exit 1
1010
compgen -f -o plusdirs -X "!*.xml" -- "$cur"
1111
)) || continue
12-
for i in ${!arr[*]}; do
12+
for i in "${!arr[*]}"; do
1313
case ${arr[i]} in
1414
packages*) unset -v "arr[i]" ;; # not a MIME type dir
1515
*.xml) arr[i]=${arr[i]%.xml} ;;
1616
*/*) ;;
1717
*) arr[i]+=/ ;;
1818
esac
1919
done
20-
COMPREPLY+=("${arr[@]}")
20+
((${#arr[@]})) &&
21+
COMPREPLY+=("${arr[@]}")
2122
done
22-
[[ $COMPREPLY != */ ]] || compopt -o nospace
23+
[[ ${COMPREPLY-} != */ ]] || compopt -o nospace
2324
}
2425

2526
_xdg_mime()

0 commit comments

Comments
 (0)