$ ssh fo<tab> foo fool football
How would I write a for loop to iterate over those values?
#!/usr/bin/env bash for SERVER in $(ssh fo<MAGIC HERE>) ; do echo $SERVER ; done
The list could change regularly, so hardcoding the values is not an option. In the specific case of SSH, I understand that I could grep the SSH config file for the matching hosts. But some other completion situations arise, such as:
$ git che<tab> checkout cherry cherry-pick
The answer should be useful for these other ad-hoc completions as well.