Take a look at compgen
, a builtin command which lets you generates completion matches the same way bash does.
$ compgen -c unam
uname
Alternatively, run bash in interactive mode with -i
. Then it will perform Tab-completion.
$ bash -i <<< $'unam\t'
$ bash -i <<< $'unam\t'
$ uname
Darwin
$ exit