Igor Murzov db8d3eeeeb mount, umount: Add linux-specific completions.
This linux-specific completion won't parse /etc/fstab as a lot of people
including myself find it useless. And there is no reliable way to guess
what user wants to mount. Some examples of what is ok for mount:

 $ mount /home
 $ mount /dev/sda1 /home
 $ mount file.iso /media/iso -o loop
 $ mount LABEL=mydisk /media/disk

It is more sane to provide just filenames completion for mount.
2011-11-20 01:26:51 +03:00

22 lines
525 B
Bash

# umount(8) completion -*- shell-script -*-
if [[ $OSTYPE == *linux* ]]; then
. "$BASH_SOURCE.linux"
return
fi
# umount(8) completion. This relies on the mount point being the third
# space-delimited field in the output of mount(8)
#
_umount()
{
local cur prev words cword
_init_completion || return
local IFS=$'\n'
COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) )
} &&
complete -F _umount -o dirnames umount
# ex: ts=4 sw=4 et filetype=sh