On Thu, Aug 18, 2011 at 05:19:32AM -0400, Fozzy C. Dressel wrote: > hi. > > I'm trying since weeks to realize a multiword completion with the bash > builtin "read". The only success I get is with single-word completion > an the "history -l/-s" trick.
I would advise you to attach your completion as it will ease the understanding of your issue. I think the "multi-word" expression may be misleading: you're looking to write a completion script which handle more than 1 argument isn't ? > > I wrote a menusystem to let users create/enter/delete project-folder, > run/edit/remove plugins in ths folders. > > For a better understanding, a small example: > > multicheck> <TAB><TAB> the default completion for the empty string is to complete with commands available in $PATH > multicheck> > project login logout cd view .... > multicheck> pr<TAB> > multicheck> project > multicheck> project <TAB><TAB> > multicheck> project > project login cd view ... > > It get the same list again, here now it should return the list of > available project-folders ... so you're looking to complete the "project" command ? So create the _project() function then test $prev (if needed), $cur, ... and in the default case (this one above), complete with the least of available project-folders as you wish. > > multicheck> project <TAB><TAB> > multickeck> project > mpathcheck sysadmin ... function _project() { # default behavior COMPREPLY=( $(compgen -W "mpathcheck sysadmin" -- $cur) ) return 0; } complete -F _project project > Calling multicheck in bash as cmd, die BComp. works fine as expected, so > it seems that I've understoud BC ... but I'm not able to do this with > the read-statement inside a bash-script. I don't know what "multicheck" is. What "die" ? how is the "read" statement related ? again, you should attach some code so we can figure out what your problem is. Raph _______________________________________________ Bash-completion-devel mailing list Bash-completion-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel