#!/bin/bash ###################################################### ### things to do AFTER host/user-specific settings ### ###################################################### ### .... ### ### BASH ### ### '''' ### __make_ps1d() { lastrv=$(cat /var/tmp/bash-rv/$$.lastrv) if [ $lastrv -gt 126 ]; then echo " \$" elif [ $lastrv -gt 0 ]; then echo " \$" else echo " \$" fi } __save_rv() { echo $1 > /var/tmp/bash-rv/$$.lastrv } make_ps1() { # these functions must be already defined by ~/.bash/user/*.bashrc # and ~/.bash/host/*.bashrc svrc='$(__save_rv $?)' ps1u=$(make_ps1u) ps1h=$(make_ps1h) ps1w="$lblue\w$normal"; ps1G='$(__git_ps1 "(%s)")'; ps1g="$green$ps1G$normal"; ps1D='$(__make_ps1d $?)'; ps1d="$ps1D"; echo "$svrc$ps1u@$ps1h:$ps1w$ps1g$ps1d$normal "; } make_ps2() { echo "$white>$yellow>$lyellow>$normal "; } # and use to assemble own PS1 export PS1=$(make_ps1) export PS2=$(make_ps2) ### ...... ### ### OTHERS ### ### '''''' ###