/bash_completion_lib/include/_expand
http://github.com/brinkman83/bashrc · #! · 16 lines · 14 code · 2 blank · 0 comment · 0 complexity · 4d9b58ae5dd42a5d389a1f47658d7fb0 MD5 · raw file
- # This function expands tildes in pathnames
- #
- _expand()
- {
- [ "$cur" != "${cur%\\}" ] && cur="$cur\\"
- # expand ~username type directory specifications
- if [[ "$cur" == \~*/* ]]; then
- eval cur=$cur
-
- elif [[ "$cur" == \~* ]]; then
- cur=${cur#\~}
- COMPREPLY=( $( compgen -P '~' -u $cur ) )
- return ${#COMPREPLY[@]}
- fi
- }