(umount) Parse /proc/mounts instead of mount output on Linux
This makes it possible to easily unmount paths with spaces. Those are common when automatically mounting usb devices.
This commit is contained in:
parent
4375c4b94e
commit
6d44b8033a
@ -120,12 +120,18 @@ complete -F _mount -o default -o dirnames mount
|
|||||||
have umount &&
|
have umount &&
|
||||||
_umount()
|
_umount()
|
||||||
{
|
{
|
||||||
local cur IFS=$'\n'
|
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=`_get_cword`
|
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) )
|
local cur=`_get_cword`
|
||||||
|
|
||||||
|
if [[ $(uname -s) = Linux && -r /proc/mounts ]]; then
|
||||||
|
# Linux /proc/mounts is properly quoted. This is important when
|
||||||
|
# unmounting usb devices with pretty names.
|
||||||
|
_linux_fstab < /proc/mounts
|
||||||
|
else
|
||||||
|
local IFS=$'\n'
|
||||||
|
COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) )
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
} &&
|
} &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user