-# umount(8) completion. This relies on the mount point being the third
-# space-delimited field in the output of mount(8)
+# umount(8) completion. The mount point should be the third
+# space-delimited field in the output of mount(8), however it
+# can itself contain spaces like any other filename of course.
+# The first two calls to 'sed' strip away the two preceding
+# and three following space-delimited fields
+# It might fail if any OTHER field except the mount point
+# contained a space, however it appears this does not happen.
#
_umount()
{
@@ -841,7 +846,7 @@
COMPREPLY=()
cur=`_get_cword`
- COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ) )
+ COMPREPLY=( $( compgen -W '$( mount |sed '\''s/ type [^ ]* [^ ]*$//'\'' | sed '\''s/^[^ ]* on //'\'' | sed '\''s/ /\\ /g'\'' )' -- $cur ) )
The patch below fixed this for me on karmic, hope it helps.
--- /etc/bash_ completion 2010-07-01 21:38:36.000000000 +0100
+++ bash_completion 2010-11-20 10:07:56.150837242 +0000
@@ -831,8 +831,13 @@
}
complete -F _chgrp $filenames chgrp
-# umount(8) completion. This relies on the mount point being the third
-# space-delimited field in the output of mount(8)
+# umount(8) completion. The mount point should be the third
+# space-delimited field in the output of mount(8), however it
+# can itself contain spaces like any other filename of course.
+# The first two calls to 'sed' strip away the two preceding
+# and three following space-delimited fields
+# It might fail if any OTHER field except the mount point
+# contained a space, however it appears this does not happen.
#
_umount()
{
@@ -841,7 +846,7 @@
COMPREPLY=()
cur=`_get_cword`
- COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ) )
+ COMPREPLY=( $( compgen -W '$( mount |sed '\''s/ type [^ ]* [^ ]*$//'\'' | sed '\''s/^[^ ]* on //'\'' | sed '\''s/ /\\ /g'\'' )' -- $cur ) )
return 0
}