Skip to content

Commit 75f03ba

Browse files
committed
bash-completion: (umount) use findmnt, escape a space in paths
# mount /dev/sdc1 /mnt/test/foo\ bar # umount <tab> has to return "/mnt/test/foo\ bar". Changes: * don't use mount | awk output, we have findmnt * force compgen use \n as entries separator Addresses: #539 Signed-off-by: Karel Zak <kzak@redhat.com>
1 parent d9a388d commit 75f03ba

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: bash-completion/umount

+5-4
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ _umount_module()
4040
return 0
4141
;;
4242
esac
43-
local DEVS_MPOINTS
44-
DEVS_MPOINTS="$(mount | awk '{print $1, $3}')"
45-
COMPREPLY=( $(compgen -W "$DEVS_MPOINTS" -- $cur) )
46-
return 0
43+
44+
local oldifs=$IFS
45+
IFS=$'\n'
46+
COMPREPLY=( $( compgen -W '$(findmnt -lno TARGET | sed "s/\([[:blank:]]\)/\\\\\1/g")' -- "$cur" ) )
47+
IFS=$oldifs
4748
}
4849
complete -F _umount_module umount

0 commit comments

Comments
 (0)