![](/img/trans.png)
[英]Using command echo in a .sh file doesn't works in TWRP recovery. How to do to display message using script .sh in TWRP
[英]Using Emacs TRAMP with an ssh server that doesn't provide /bin/sh?
我试图使用Emacs TRAMP在不提供/bin/sh
的服务器上通过ssh访问文件,因此当我尝试连接时出现以下错误:
env: can't execute '/bin/sh': No such file or directory
有没有办法告诉TRAMP远程shell用于该服务器的位置? (“服务器”是一个系留Android手机,所以在/system/bin/sh
。)
另请参见tramp-methods
变量的docstring。 这部分看起来值得注意:
tramp-remote-shell
这指定了要在远程主机上使用的shell。 这必须是一个类似Bourne的shell。 通常没有必要将其设置为“/ bin / sh”以外的任何值:Tramp想要使用一个可以进行波形扩展的shell,但它可以搜索它。 另请注意,所有Unixen上都存在“/ bin / sh”,对于您决定使用的值,这可能不正确。 你被警告了。
编辑:
所以这里有一种方法可以创建一个基于现有方法的新方法(在本例中为“scpc”),然后为自定义方法提供一个不同的远程shell:
(require 'tramp)
(let* ((base-method (cdr (assoc "scpc" tramp-methods)))
(new-method (copy-tree base-method))
(rshell (assq 'tramp-remote-shell new-method)))
(setcdr rshell "/system/bin/sh")
(add-to-list 'tramp-methods (cons "android" new-method)))
请注意,在Emacs 23(Tramp 2.1.20)中,此属性名为tramp-remote-sh
。 在Emacs 24(Tramp 2.2.3-24.1)中,它已被更改为tramp-remote-shell
。
我猜你可以默认使用这个方法为你指定的主机:
(add-to-list
'tramp-default-method-alist
(list "\\`myhost\\'" nil "android"))
ssh希望使用远程用户的登录shell。 如果您具有服务器的root访问权限,则可以更改passwd文件中的条目:
:嗒嗒:嗒嗒:USER_NAME:嗒嗒:/路径/到/壳
或者只是symlink / bin / sh。
我不相信有任何方法可以从客户端改变这一点,但如果有,你需要告诉ssh
,而不是TRAMP。 (您可以通过ssh_config文件执行此操作。)
编辑:我纠正了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.