completion: Use read -r rather then plain read

This means that backslashes in the input (which is unlikely, but I guess
possible) won’t affect line splitting. Spotted by shellcheck.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-04-16 14:07:12 +01:00
parent b1ef6a125e
commit 7ad93a0c95
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73

View File

@ -53,7 +53,7 @@ __gio_location() {
# List volumes and mounts # List volumes and mounts
local mounts=( ) local mounts=( )
local mount local mount
while IFS=$'\n' read mount; do while IFS=$'\n' read -r mount; do
# Do not care about local mounts # Do not care about local mounts
[[ "$mount" =~ ^"file:" ]] && continue [[ "$mount" =~ ^"file:" ]] && continue
@ -69,7 +69,7 @@ __gio_location() {
local files=() local files=()
local names=() local names=()
local name size type local name size type
while IFS=$'\t' read name size type; do while IFS=$'\t' read -r name size type; do
# Escape name properly # Escape name properly
local escaped_name local escaped_name
escaped_name="$(printf "%q" "$name")" escaped_name="$(printf "%q" "$name")"