[Bash-completion-commits] [SCM] bash-completion branch, master, updated. f294219990569082b20e08643b6e46256ca0862f

Crestez Dan Leonard cdleonard at gmail.com
Mon Feb 15 13:40:13 UTC 2010


The following commit has been merged in the master branch:
commit 6d44b8033a2993e965c8b1fa97cba9d11fa7022e
Author: Crestez Dan Leonard <cdleonard at gmail.com>
Date:   Mon Feb 15 14:13:51 2010 +0200

    (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.

diff --git a/contrib/mount b/contrib/mount
index e4a7437..6fbb24f 100644
--- a/contrib/mount
+++ b/contrib/mount
@@ -120,12 +120,18 @@ complete -F _mount -o default -o dirnames mount
 have umount &&
 _umount()
 {
-    local cur IFS=$'\n'
-
     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
 } &&

-- 
bash-completion



More information about the Bash-completion-commits mailing list