_optcomplete() { COMPREPLY=( $(COMP_LINE=$COMP_LINE COMP_POINT=$COMP_POINT COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD OPTPARSE_AUTO_COMPLETE=1 "$1") ) } and then i bind using complete -F _optcomplete my_command the results is like that [root@sbs-ox5 sysaid]# ./sysaid manage-ou --display Accounts" /OxObjects/AdminObjects /OxObjects/ResourceObjects/ResourceGroups "/Address /OxObjects/AdminObjects/AvailableServers /OxObjects/ResourceObjects/Resources Book" /OxObjects/AdminObjects/AvailableServers/directoryServer /OxObjects/SharedFolder /Computers /OxObjects/AdminObjects/AvailableServers/groupwareServer "/Password Configs" /OxObjects/AdminObjects/AvailableServers/imapServer Policies" /dhcp /OxObjects/AdminObjects/AvailableServers/smtpServer /sudoers /dns /OxObjects/AdminObjects/AvailableServers/webmailServer "/System /Groups /OxObjects/AdminObjects/DNSObjects /Users Groups" /OxObjects/AdminObjects/SMTPObjects /Users/uid=fbe/addr /Idmap /OxObjects/AdminObjects/SMTPObjects/MailTransports /OxObjects /OxObjects/ResourceObjects