Is there a nice way to print (e.g. to stdout) a list of all possible completions of a command in bash (the ones it would give me if I typed the command, then pressed tab)?
Edit: I guess this wasn't really clear, now that I read it again. I know how to get completions manually. I want to do it programmatically.