This commit is contained in:
luk
2026-02-01 19:17:14 +08:00
parent f01868e246
commit 5920cde656
2 changed files with 8 additions and 8 deletions

View File

@@ -136,9 +136,9 @@ if [[ -n "$SSH_CONNECTION" ]]; then
IN_SSH="[ssh]"
fi
if [ "$color_prompt" = yes ]; then
PS1='<\[\033[07;32m\]\t\[\033[00m\]#\[\033[07;35m\]\u\[\033[00m\]@\[\033[07;31m\]\h\[\033[00m\]^\[\033[07;34m\]$(uname -m),$(uname),$MYOSVERSION\[\033[00m\]::\[\033[07;36m\]\w\[\033[00m\]$IN_SSH> '
PS1='<\[\033[07;32m\]\t\[\033[00m\]#\[\033[07;35m\]\u\[\033[00m\]@\[\033[07;31m\]\h\[\033[00m\]^\[\033[07;34m\]$(uname -m),$(uname),$MYOSVERSION\[\033[00m\]:$IN_SSH:\[\033[07;36m\]\w\[\033[00m\]> '
else
PS1='<\t#\u@\h^$(uname -m),$(uname),$MYOSVERSION::\w$IN_SSH> ' # \w shows absolute path, \W shows current folder.
PS1='<\t#\u@\h^$(uname -m),$(uname),$MYOSVERSION:$IN_SSH:\w> ' # \w shows absolute path, \W shows current folder.
fi
unset color_prompt force_color_prompt

12
ssh.sh
View File

@@ -71,13 +71,13 @@ if [ "$password" != "null" ]
then
if [ "$(which sshpass)" ]
then
echo "::*** sshpass -p $password -X -p $port $username@$host"
sshpass -p $password ssh -X -p $port "$username@$host" $2
echo "::*** sshpass -p $password -Y -p $port $username@$host"
sshpass -p $password ssh -Y -p $port "$username@$host" $2
else
echo "::*** ssh -X -p $port $username@$host"
ssh -X -p $port "$username@$host" $2 # -X 在 linux 安装 xrdp 后连接时报错,改 -Y 就可。
echo "::*** ssh -Y -p $port $username@$host"
ssh -Y -p $port "$username@$host" $2 # -X 在 linux 安装 xrdp 后连接时报错,改 -Y 就可。
fi
else
echo "::*** ssh -X -p $port $username@$host"
ssh -X -p $port "$username@$host" $2
echo "::*** ssh -Y -p $port $username@$host"
ssh -Y -p $port "$username@$host" $2
fi