# remote system, you can use sl --rsync, or the function for that slr
# below.
-# SL_TEST_CMD: Env var. Meant to be used to vary the files synced
-# depending on the remote host. Run this string on the remote host the
-# first time sl is run (or if we run slr). The result is passed to
-# SL_TEST_HOOK. For example,
+# SL_TEST_CMD: Env var. If set, we run this string on the remote host
+# the first time sl is run (or if we run slr), and then the result is
+# passed to SL_TEST_HOOK which gets run locally. It is meant to be used
+# to vary the files synced depending on the remote host. For example,
# export SL_TEST_CMD=". /etc/os-release ; echo \${VERSION//[^a-zA-Z0-9]/}"
# SL_TEST_HOOK: Env var. It is run as $SL_TEST_HOOK. This can set
sl --rsync "$@"
}
-
-# ssh solo, without multiplexing. Good for debugging / testing.
+# ssh with multiplexing.
+ssm() {
+ sl -oControlPath=/tmp/ssh_mux_%u_%h_%p_%r "$@"
+ }
+# ssh solo, without multiplexing. # currently the default, but I might switch back.
sss() {
- ssh -oControlMaster=no -oControlPath=/ "$@"
+ ssh -oControlPath=none "$@"
}
# ssh that respects -i as the only key to use. Good for debugging.
pson() {
PROMPT_COMMAND=(prompt-command)
if [[ $TERM == *(screen*|xterm*|rxvt*) ]]; then
- trap 'auto-window-title "$BASH_COMMAND"' DEBUG
+ trap 'auto-window-title "${BASH_COMMAND:0:40}"' DEBUG
fi
}
local ps_char ps_color col tmp
- # bash 5.0.17 gives an error when the last command used a process redirect like
- # while read -r l; do e $l; done < <(echo ok)
- if [[ ! $LC_INSIDE_EMACS && $BASH_VERSION == 5.[123456789]* || $BASH_VERSION == [6789]* ]]; then
- IFS='[;' read -p $'\e[6n' -d R -rs tmp ||:
- col="${tmp##*[^0-9]}"
- fi
+
+ # note, I tried reading the current column here in order to add a
+ # space if there was non-newline terminated output from the last
+ # command. However, I found that it made ssh escape char not
+ # work. In bash 5.0.17 after a command using <() it failed and
+ # output something like ";21" to the terminal after the prompt. It
+ # did work in 5.1 something. It did not work in emacs. And, one time
+ # it just randomly output to the terminal. Not worth it.
unset IFS
fi
# version 211203 does not have this feature, 230805 does
- if [[ $KONSOLE_VERSION && $KONSOLE_VERSION == [3456789]* || $KONSOLE_VERSION == 2[3456789]* ]]; then
+ if [[ $SSH_CLIENT ]] || [[ $KONSOLE_VERSION && ! $KONSOLE_VERSION == 2[01]* ]]; then
# This is from konsole, copied after pressing ctrl-alt-] .
# I figured out what it does from reading git clone https://gitlab.freedesktop.org/Per_Bothner/specifications
#
# condition from the screen man page i think.
# note: duplicated in tx()
if [[ $TERM == *(screen*|xterm*|rxvt*) ]]; then
- trap 'auto-window-title "$BASH_COMMAND"' DEBUG
+ # 40 chars is plenty.
+ trap 'auto-window-title "${BASH_COMMAND:0:40}"' DEBUG
else
trap DEBUG
fi