Commit 1032e4d3 authored by Cédric Marie's avatar Cédric Marie

bash/init: Add login@hostname in prompt for SSH

In case of SSH session, add login@hostname in prompt. Keep the prompt
unchanged in case of local session. SSH session is detected by
SSH_CONNECTION environment variable.
Signed-off-by: Cédric Marie's avatarCédric Marie <cedric@hjuvi.fr.eu.org>
parent 1b7178bb
......@@ -29,7 +29,13 @@ if [ -f /usr/share/git-core/contrib/completion/git-prompt.sh ]; then
fi
# Set colorful prompt
if [ "$TERM" != "" ]; then
PS1='\[\e[1;31m\]╭─\[\e[1;37;43m\]\t\[\e[0m\] \[\e[1;36;44m\]\w\[\e[0;32;40m\]$(__git_ps1)\[\e[0m\]\n\[\e[1;31m\]╰────────►\[\e[0m\] '
if [ -n "$SSH_CONNECTION" ]; then
# SSH: time + login@hostname + working directory + git
PS1='\[\e[1;31m\]╭─\[\e[1;37;43m\]\t\[\e[0m\] \[\e[30;42m\]\u@\h\[\e[0m\] \[\e[1;36;44m\]\w\[\e[0;32;40m\]$(__git_ps1)\[\e[0m\]\n\[\e[1;31m\]╰────────►\[\e[0m\] '
else
# Local: time + working directory + git
PS1='\[\e[1;31m\]╭─\[\e[1;37;43m\]\t\[\e[0m\] \[\e[1;36;44m\]\w\[\e[0;32;40m\]$(__git_ps1)\[\e[0m\]\n\[\e[1;31m\]╰────────►\[\e[0m\] '
fi
fi
# Add the path to scripts if not yet present
echo $PATH | grep -q "$PAINTED_SHELL_PATH/scripts" || PATH=$PATH:$PAINTED_SHELL_PATH/scripts
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment