I'm writing a completion where, in some cases, I'd like to use COMPREPLY=() to indicate that no more arguments to a command are expected, but in other cases, I'd like to offer the default Readline behavior for filename completions.
So, if I have a directory 'foo', I'd like the shell to first complete with 'foo/' and then offer to complete files under 'foo'. But if I do something like COMPREPLY=($(compgen -f -- "$cur")), then I simply get a completion of 'foo' (with a space appended). I know I can pass "-o default" to get Readline's default filename completion when COMPREPLY is empty, but then that seems to preclude using COMPREPLY=() to deny completions. I've tried a number of different workarounds, none of which I was completely happy with (or I probably wouldn't be asking this question). The closest I got was setting "-o default", and then using COMPREPLY=("") to semi-deny completion, and COMPREPLY=() to get filename completion. Can anyone offer a better approach? Thanks, Jeremy