Sample Header Ad - 728x90

autocomplete filenames using compgen

10 votes
2 answers
7507 views
As part of a larger autocomplete function I'm writing, I want to use compgen to generate a list of files. I read the bash manual entries for compgen and complete, and from there I assumed that the option -G "*" would be the solution. I could not get it to work, though: The list of files in the current directory was shown, regardless of my input, i.e.: $ cmd aa bb cc $ cmd a aa bb cc $ cmd aa aa bb cc Therefore, I tried to debug this by using complete, which supports the same options as compgen, but I got the same result: $ complete -G "*" cmd $ cmd a aa bb cc I also tried complete -o filenames, but this doesn't work either..
Asked by daniel kullmann (9737 rep)
Dec 13, 2011, 11:48 AM
Last activity: Aug 9, 2014, 01:09 PM