2022年3月3日(木) 22:05 ladyrick via Bug reports for the GNU Bourne Again SHell <bug-bash@gnu.org>: > After many debug, I found that compgen will do command subtitution > and parameter expansion in word list.
This is actually the documented behavior. For example, the bash-completion project relies on this behavior. To obtain the result you want, we need to write it in the following way (i.e. to pass the literal '$(fc -l -10)' to the compgen builtin): compgen -W '$(fc -l -10)' -- "${COMP_WORDS[1]}"