Tab-completion on find fstype on Mac OS X --- bash_completion | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/bash_completion b/bash_completion index ec66d50..fb64eb7 100644 --- a/bash_completion +++ b/bash_completion @@ -896,7 +896,11 @@ _pgrep() # _find() { - local cur prev i exprfound onlyonce + local cur prev i exprfound onlyonce UNAME + + UNAME=$( uname -s ) + # strip OS type and version under Cygwin + UNAME=${UNAME/CYGWIN_*/Cygwin} COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} @@ -913,9 +917,15 @@ _find() ;; -fstype) # this is highly non-portable - [ -e /proc/filesystems ] && - COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | \ + if [ -e /proc/filesystems ]; then + COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | \ grep "^$cur" ) ) + elif [ $UNAME = Darwin ]; then + COMPREPLY=( $( compgen -W "local rdonly \ + $(sysctl vfs | grep 'mounted instance' | \ + cut -d '.' -f 2 | cut -d ' ' -f 1 ) " -- $cur ) ) + fi + return 0 ;; -gid)