This commit is contained in:
Kovid Goyal 2022-03-05 09:20:08 +05:30
parent f0b79f88b2
commit f6706a55ec
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 0 deletions

View file

@ -158,6 +158,7 @@ _ksi_main() {
if [[ -n "$SSH_TTY$SSH2_TTY" ]]; then
_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
# see https://www.gnu.org/software/bash/manual/html_node/Controlling-the-Prompt.html#Controlling-the-Prompt

View file

@ -236,6 +236,7 @@ _ksi_deferred_init() {
if [[ -n "$SSH_TTY$SSH2_TTY" ]]; then
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