Function: tramp-find-shell
tramp-find-shell is a byte-compiled function defined in
tramp-sh.el.gz.
Signature
(tramp-find-shell VEC)
Documentation
Open a shell on the remote host which groks tilde expansion.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-find-shell (vec)
"Open a shell on the remote host which groks tilde expansion."
;; If we are in `make-process', we don't need another shell.
(unless (tramp-get-connection-property vec " process-name")
(with-current-buffer (tramp-get-buffer vec)
(let ((default-shell (tramp-get-method-parameter vec 'tramp-remote-shell))
shell)
(setq shell
(with-tramp-connection-property vec "remote-shell"
;; CCC: "root" does not exist always, see my QNAP
;; TS-459. Which check could we apply instead?
(tramp-send-command
vec (format "echo ~%s" tramp-root-id-string) t)
(if (or (string-match-p
(rx bol "~" (literal tramp-root-id-string) eol)
(buffer-string))
;; The default shell (ksh93) of OpenSolaris
;; and Solaris is buggy. We've got reports
;; for "SunOS 5.10" and "SunOS 5.11" so far.
(tramp-check-remote-uname vec tramp-sunos-unames))
(or (tramp-find-executable
vec "bash" (tramp-get-remote-path vec) t t)
(tramp-find-executable
vec "ksh" (tramp-get-remote-path vec) t t)
;; Maybe it works at least for some other commands.
(prog1
default-shell
(tramp-warning
vec
(concat
"Couldn't find a remote shell which groks tilde "
"expansion, using `%s'")
default-shell)))
default-shell)))
;; Open a new shell if needed.
(unless (string-equal shell default-shell)
(tramp-message
vec 5 "Starting remote shell `%s' for tilde expansion" shell)
(tramp-open-shell vec shell))))))