![고쳐 쓰다:](https://linux55.com/image/96529/%EA%B3%A0%EC%B3%90%20%EC%93%B0%EB%8B%A4%3A.png)
에서는 zsh
ssh 및 scp가 의 호스트를 사용하여 수행됩니다 /etc/hosts
. 그러나 대문자를 사용하고 분명히 호스트가 아닌 파일을 참조하는 경우에도 호스트 이름을 일치시키려고 합니다.
$ scp -rp F<tab>
FOO.txt foo.mydomain.com
이 기능을 비활성화하고 싶습니다. 나는 다음 줄을 변경했습니다/usr/share/zsh/functions/Completion/Unix/_ssh
compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts
도착하다
compadd "$@" $config_hosts
이제 ssh 명령을 입력하기 시작하고 탭을 사용하여 호스트 이름을 자동 완성하면 ssh foo<tab>
오류가 발생합니다.
_all_labels:39: command not found: -J
이는 무엇을 의미하며 어떻게 해결할 수 있나요?
두 번째 문제는 Unix/_ssh를 변경한 후 완료 파일을 다시 컴파일할 수 없다는 것입니다.
zcompile Unix/ Unix.zwc
zcompile: can't open file: Unix.zwc
Ctrl+ +를 누르면 다음 과 X같은 결과가 나옵니다 ?.
$ scp -rp TE
Trace output left in /tmp/zsh10048scp3 (up-history to view)
TESTING.txt
testing testing.mydomain.com
여기서 TESTING.txt는 파일이고 는 호스트 이름 testing
입니다.testing.mydomain.com
고쳐 쓰다:
_all_labels:39
호스트에서만 위의 오류가 발생하는 것으로 나타났습니다 ProxyCommand
. ~/.ssh/config
여기에는 다음이 포함됩니다.
Host testing testing.mydomain.com
Hostname testing.mydomain.com
User root
PubkeyAuthentication yes
StrictHostKeyChecking yes
UserKnownHostsFile ~/.ssh/known_hosts
ProxyCommand ssh server2.mydomain.com nc %h %p
답변1
이전 줄의 "\"를 제거하지 않았는지 확인하세요./usr/share/zsh/functions/완성/Unix/_ssh, 동시에 변경합니다.
_wanted hosts expl 'remote host name' \
compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts
이렇게 했습니다(연속 문자 "\"를 제거했습니다)구함줄) 다음과 똑같은 오류가 발생합니다.
_all_labels:39: command not found: -J
또 다른 가능성은 실수로 "\" 뒤에 추가 공백을 추가하여 비활성화했을 수도 있다는 것입니다.
귀하의 질문의 두 번째 부분과 관련하여 사용할 올바른 구문은 다음과 같습니다.
zcompile Unix.zwc Unix/*
(Unix의 모든 것을 Unix.zwc로 컴파일합니다)