completion: Quote variable dereferences within variable dereferences

Otherwise they could get split. Spotted by shellcheck.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-04-16 14:06:13 +01:00
parent d3d811f4e5
commit b1ef6a125e
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73
2 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ __gdbus() {
*:*) *:*)
case "$COMP_WORDBREAKS" in case "$COMP_WORDBREAKS" in
*:*) *:*)
local colon_word=${cur%${cur##*:}} local colon_word=${cur%"${cur##*:}"}
local i=${#COMPREPLY[*]} local i=${#COMPREPLY[*]}
while [ $((--i)) -ge 0 ]; do while [ $((--i)) -ge 0 ]; do
COMPREPLY[i]=${COMPREPLY[i]#"$colon_word"} COMPREPLY[i]=${COMPREPLY[i]#"$colon_word"}

View File

@ -47,7 +47,7 @@ __gio_location() {
dir="$cur" dir="$cur"
elif [[ $cur =~ "/" ]]; then elif [[ $cur =~ "/" ]]; then
# Subtract basename because dirname cmd doesn't work well with schemes # Subtract basename because dirname cmd doesn't work well with schemes
dir=${cur%$(basename "$cur")} dir=${cur%"$(basename "$cur")"}
fi fi
# List volumes and mounts # List volumes and mounts