PageRenderTime 87ms CodeModel.GetById 85ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion_lib/include/_expand

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