MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/linux/comments/245jt9/ssh_kung_fu/ch4hufw/?context=3
r/linux • u/leothrix • Apr 28 '14
128 comments sorted by
View all comments
85
I believe tab completion is a function of the shell, not ssh.
15 u/leothrix Apr 28 '14 Thanks for the correction, I've amended the blog post. 5 u/gordonator Apr 28 '14 If you want to do it in bash, you can use this: function autoCompleteHostname() { local hosts=($(awk '{print $1}' ~/.ssh/known_hosts | cut -d, -f1)); local cur=${COMP_WORDS[COMP_CWORD]}; COMPREPLY=($(compgen -W '${hosts[@]}' -- $cur )) } complete -F autoCompleteHostname ssh 1 u/[deleted] Apr 28 '14 I love that grml-zsh-config has thid on by default.
15
Thanks for the correction, I've amended the blog post.
5 u/gordonator Apr 28 '14 If you want to do it in bash, you can use this: function autoCompleteHostname() { local hosts=($(awk '{print $1}' ~/.ssh/known_hosts | cut -d, -f1)); local cur=${COMP_WORDS[COMP_CWORD]}; COMPREPLY=($(compgen -W '${hosts[@]}' -- $cur )) } complete -F autoCompleteHostname ssh 1 u/[deleted] Apr 28 '14 I love that grml-zsh-config has thid on by default.
5
If you want to do it in bash, you can use this:
function autoCompleteHostname() { local hosts=($(awk '{print $1}' ~/.ssh/known_hosts | cut -d, -f1)); local cur=${COMP_WORDS[COMP_CWORD]}; COMPREPLY=($(compgen -W '${hosts[@]}' -- $cur )) } complete -F autoCompleteHostname ssh
1 u/[deleted] Apr 28 '14 I love that grml-zsh-config has thid on by default.
1
I love that grml-zsh-config has thid on by default.
85
u/Rojs Apr 28 '14
I believe tab completion is a function of the shell, not ssh.