32 lines
728 B
Plaintext
Raw Normal View History

# bash export completion
_export()
{
local cur prev words cword
_init_completion || return
case ${words[@]} in
*=\$*)
COMPREPLY=( $( compgen -v -P '$' -- "${cur#*=\$}" ) )
;;
*[^=])
COMPREPLY=( $( compgen -v -S '=' -- "$cur" ) )
;;
*=)
COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" |
( echo -n \'
sed -e 's/'\''/'\''\\\'\'''\''/g'
echo -n \' ) )" )
;;
esac
} &&
complete -F _export -o default -o nospace export
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh