File tree Expand file tree Collapse file tree 2 files changed +48
-20
lines changed
Expand file tree Collapse file tree 2 files changed +48
-20
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env zsh
2+
3+ mosh () {
4+ local HOST=" ${1:? Usage: $0 HOST [mosh args...]} "
5+ shift || true
6+
7+ local MOSH_PATH=" $( whence -p mosh) "
8+ # These may also be necessary:
9+ # -T -o ClearAllForwardings=yes
10+ local MOSH_SSH_OPTIONS=" -o ExitOnForwardFailure=no -o ForwardAgent=no"
11+ # If RemoteCommand is non-empty, override it for the SSH that mosh uses.
12+ if [[ -n " $( ssh-remote-command $HOST ) " ]]; then
13+ " ${MOSH_PATH} " --ssh=" ssh ${MOSH_OPTIONS} -o RemoteCommand=none -o RequestTTY=no" -- " ${HOST} " " $@ "
14+ else
15+ " ${MOSH_PATH} " --ssh=" ssh ${MOSH_OPTIONS} " -- " ${HOST} " " $@ "
16+ fi
17+ }
18+
19+ ssh-remote-command () {
20+ local HOST=" ${1:? Usage: $0 HOST} "
21+ shift || true
22+ # Ask ssh what it would do after config expansion.
23+ # ssh -G prints: "remotecommand <value>" (empty if none; may also be absent on some versions)
24+ return " $( ssh -G -- " $HOST " 2> /dev/null | awk ' tolower($1)=="remotecommand" { $1=""; sub(/^ /,""); print; exit }' ) "
25+ }
26+
27+ autosshfs () {
28+ # local REMOTE="${1:?Usage: $0 HOST [sshfs args...]}"
29+ # shift || true
30+ # local HOST="${REMOTE%%:*}"
31+
32+ local SSHFS_PATH=" $( whence -p sshfs) "
33+ # If RemoteCommand is non-empty, override it for the SSH that sshfs uses.
34+ # if [[ -n "$(ssh-remote-command $HOST)" ]]; then
35+ # "${SSHFS_PATH}" -o ssh_command="ssh -o RemoteCommand=none" "${REMOTE}" "$@"
36+ # else
37+ # "${SSHFS_PATH}" "${REMOTE}" "$@"
38+ # fi
39+
40+ # -o compression=no \
41+ " ${SSHFS_PATH} " \
42+ -o dir_cache=yes \
43+ -o follow_symlinks \
44+ -o max_conns=4 \
45+ -o reconnect \
46+ -o ssh_command=" ssh -o RemoteCommand=none" \
47+ " $@ "
48+ }
Original file line number Diff line number Diff line change @@ -67,26 +67,6 @@ fix-kde-hard() {
6767 kwin_wayland --replace &
6868}
6969
70- mosh () {
71- local HOST=" ${1:? Usage: $0 HOST [mosh args...]} "
72- shift || true
73-
74- # Ask ssh what it would do after config expansion.
75- # ssh -G prints: "remotecommand <value>" (empty if none; may also be absent on some versions)
76- local RC=" $( ssh -G -- " $HOST " 2> /dev/null | awk ' tolower($1)=="remotecommand" { $1=""; sub(/^ /,""); print; exit }' ) "
77-
78- local MOSH_PATH=" $( whence -p mosh) "
79- # These may also be necessary:
80- # -T -o ClearAllForwardings=yes
81- local MOSH_SSH_OPTIONS=" -o ExitOnForwardFailure=no -o ForwardAgent=no"
82- # If RemoteCommand is non-empty, override it for the SSH that mosh uses.
83- if [[ -n " ${RC} " ]]; then
84- " ${MOSH_PATH} " --ssh=" ssh ${MOSH_OPTIONS} -o RemoteCommand=none -o RequestTTY=no" -- " ${HOST} " " $@ "
85- else
86- " ${MOSH_PATH} " --ssh=" ssh ${MOSH_OPTIONS} " -- " ${HOST} " " $@ "
87- fi
88- }
89-
9070pdfsearch () {
9171 # https://stackoverflow.com/questions/4643438/how-to-search-contents-of-multiple-pdf-files
9272 if [ $# -ne 2 ]; then
You can’t perform that action at this time.
0 commit comments