get rid of the who -m ssh session test

I dont like executing a binary in a fast startup script. Lets see
if there are a lot of sessions in the wild that dont use the SSH_TTY
env var
This commit is contained in:
Kovid Goyal 2022-03-06 15:47:08 +05:30
parent 75d5e386d3
commit 795953a341
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 11 deletions

View File

@ -157,9 +157,6 @@ _ksi_main() {
if [[ "${_ksi_prompt[title]}" == "y" ]]; then if [[ "${_ksi_prompt[title]}" == "y" ]]; then
if [[ -n "$SSH_TTY$SSH2_TTY" ]]; then if [[ -n "$SSH_TTY$SSH2_TTY" ]]; then
_ksi_prompt[hostname_prefix]="\h: "; _ksi_prompt[hostname_prefix]="\h: ";
elif [[ -n "$(builtin command -v who)" ]]; then
# OpenSSH's sshd creates entries in utmp for every login so use those
[[ "$(builtin command who -m 2> /dev/null)" =~ "\([a-fA-F.:0-9]+\)$" ]] && _ksi_prompt[hostname_prefix]="\h: ";
fi fi
# see https://www.gnu.org/software/bash/manual/html_node/Controlling-the-Prompt.html#Controlling-the-Prompt # see https://www.gnu.org/software/bash/manual/html_node/Controlling-the-Prompt.html#Controlling-the-Prompt
# we use suffix here because some distros add title setting to their bashrc files by default # we use suffix here because some distros add title setting to their bashrc files by default

View File

@ -235,9 +235,6 @@ _ksi_deferred_init() {
builtin local is_ssh_session="n" builtin local is_ssh_session="n"
if [[ -n "$SSH_TTY$SSH2_TTY" ]]; then if [[ -n "$SSH_TTY$SSH2_TTY" ]]; then
is_ssh_session="y"; is_ssh_session="y";
elif [[ -n "$(builtin command -v who)" ]]; then
# OpenSSH's sshd creates entries in utmp for every login so use those
[[ "$(builtin command who -m 2> /dev/null)" =~ "\([a-fA-F.:0-9]+\)$" ]] && is_ssh_session="y";
fi fi
if [[ "$is_ssh_session" == "y" ]]; then if [[ "$is_ssh_session" == "y" ]]; then