mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
Fix SSH hostname on Linux
This commit is contained in:
parent
f0fdf1d4f0
commit
a241377632
2 changed files with 20 additions and 2 deletions
11
bash/prompt
11
bash/prompt
|
|
@ -57,8 +57,17 @@ set_prompt() {
|
||||||
|
|
||||||
local buffer=""
|
local buffer=""
|
||||||
|
|
||||||
|
local hostname=""
|
||||||
|
if [[ -n $HOST ]]; then
|
||||||
|
hostname="${HOST%.local}"
|
||||||
|
elif [[ -n $HOSTNAME ]]; then
|
||||||
|
hostname="${HOSTNAME}"
|
||||||
|
else
|
||||||
|
hostname="$(hostname -s)"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n $SSH_CLIENT ]]; then
|
if [[ -n $SSH_CLIENT ]]; then
|
||||||
buffer="${buffer}${HOST%.local} "
|
buffer="${buffer}${hostname} "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $STY ]]; then
|
if [[ -n $STY ]]; then
|
||||||
|
|
|
||||||
11
zsh/prompt
11
zsh/prompt
|
|
@ -131,8 +131,17 @@ set_prompt() {
|
||||||
|
|
||||||
local buffer=""
|
local buffer=""
|
||||||
|
|
||||||
|
local hostname=""
|
||||||
|
if [[ -n $HOST ]]; then
|
||||||
|
hostname="${HOST%.local}"
|
||||||
|
elif [[ -n $HOSTNAME ]]; then
|
||||||
|
hostname="${HOSTNAME}"
|
||||||
|
else
|
||||||
|
hostname="$(hostname -s)"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n $SSH_CLIENT ]]; then
|
if [[ -n $SSH_CLIENT ]]; then
|
||||||
buffer="${buffer}${HOST%.local} "
|
buffer="${buffer}${hostname} "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $STY ]]; then
|
if [[ -n $STY ]]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue