Open FrederikNJS opened 3 years ago
Thanks for reporting!
That's caused by the parsing of the alias:
Which turns ssh example.com
into TERM=xterm-256color ssh example.com
. That's not matched by the rule β as it expects a command starting with ssh
rather than TERM
.
Meanwhile, you can use a ZSH function instead:
function ssh() {
TERM=xterm-256color command ssh $@
}
That workaround worked beautifully! Thank you! This would be awesome to add to the documentation, possibly a FAQ.
I might be interested in helping solve this, but I'd love to know what kind of a solution you would be interested in.
_parse_alias
function to handle prefixed environment variables?alias ssh=lolwat
would still match ssh_known_hosts
?I'm glad it worked! It's also great that you're willing to fix it! π
Looking at it a bit closer, it actually happens with any command starting with a variable definition, e.g. TERM=xterm-256color ssh lab.oh-my.fish
or foo=bar echoo "foo is $foo"
. I have only a glimpse of a solution in mind, I'll come back here once it's more solid.
In the meantime, it would be awesome to mention this in Troubleshooting.
I have tried using Kitty Terminal Emulator and Termite Terminal Emulator. Both of these modify the terminfo significantly, and therefore SSH necessitates creating an alias to maintain full terminal functionality when ssh'ing into servers that don't have these terminal emulators installed. For both terminal emulators, a simple alias for
alias ssh=TERM='xterm-256color' ssh
sets the terminal type such that you get color support. But Kitty additionally has a special feature to make the terminal even smarter over SSH. Whenever I define any of there ssh-aliases, thessh_known_hosts
rule stops functioning.The output of
thefuck --version
(something likeThe Fuck 3.1 using Python 3.5.0 and Bash 4.4.12(1)-release
):Your system (Debian 7, ArchLinux, Windows, etc.):
How to reproduce the bug:
ssh
. I created the recommended ssh alias for kitty:alias ssh=kitty +kitten ssh
. But also saw the same problem with a simpler fallback alias for ssh:alias ssh=TERM='xterm-256color' ssh
which should work in any terminal emulator.fuck
.ssh_known_hosts
doesn't match, and thefuck instead simply recommends the exact same ssh command I just typed, without any side-effect.If I remove the alias, then
ssh_known_hosts
starts working as expected again.The output of The Fuck with
THEFUCK_DEBUG=true
exported (typically executeexport THEFUCK_DEBUG=true
in your shell before The Fuck):If the bug only appears with a specific application, the output of that application and its version:
Anything else you think is relevant: