dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit d4d9b30dc9cc51cd1cd3ce35b40201ffc939b7cb (patch)
parent a97bf2cab6ce4d6592b02adca5e78e0739a7297a
Author: Alexander Karle <akarle@umass.edu>
Date:   Sat, 10 Nov 2018 18:47:11 +0000

[bash] add ssh text to bash prompt

Diffstat:
Mbash/bash_prompt | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/bash/bash_prompt b/bash/bash_prompt @@ -12,6 +12,12 @@ if infocmp xterm-256color >/dev/null 2>&1; then fi fi +if [ -n "$SSH_CLIENT" ]; then + ssh_text="[$USER@$(hostname)] " +else + ssh_text="" +fi + function parse_git_dirty() { [[ $(git status 2> /dev/null | tail -n1) != *"working directory clean"* ]] && \ [[ $(git status 2> /dev/null | tail -n1) != *"working tree clean"* ]] && echo "*" @@ -31,7 +37,7 @@ if tput setaf 1 &> /dev/null; then tput sgr0 BOLD="\[$(tput bold)\]" RESET="\[$(tput sgr0)\]" - export PS1="\n$BOLD$BLUE\w $RESET$GRAY\$(parse_git_branch)"$'\n'"$BOLD$MAGENTA\$ $RESET" + export PS1="\n$BOLD$BLUE\w $RESET$GRAY${ssh_text}\$(parse_git_branch)"$'\n'"$BOLD$MAGENTA\$ $RESET" export PS2="$ORANGE→ $RESET" else # TODO: write better case for too few colors...