From fe4f98349e09ba9fd7edaa62fcc43ac5bbc49b67 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Mon, 27 Aug 2012 11:45:04 +0200 Subject: [PATCH 1/2] Add support of /etc/debian_chroot Debian uses the file /etc/debian_chroot to give a name to a chroot. The default /etc/bash.bashrc contains: if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' --- liquidprompt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/liquidprompt b/liquidprompt index e067be6..e089fd7 100755 --- a/liquidprompt +++ b/liquidprompt @@ -347,7 +347,11 @@ lcl) fi ;; ssh) - LP_HOST="${NO_COL}@${LP_COLOR_SSH}${_LP_HOST_SYMBOL}${NO_COL}" + if [ -r /etc/debian_chroot ] ; then + _LP_HOST_CHROOT=$(cat /etc/debian_chroot) + _LP_HOST_CHROOT="($_LP_HOST_CHROOT)" + fi + LP_HOST="${NO_COL}@${LP_COLOR_SSH}${_LP_HOST_CHROOT}${_LP_HOST_SYMBOL}${NO_COL}" ;; tel) LP_HOST="${NO_COL}@${LP_COLOR_TELNET}${_LP_HOST_SYMBOL}${NO_COL}" From d870fc474236deffdba31523a4f50fb01ae61f01 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Sat, 8 Sep 2012 15:59:05 +0200 Subject: [PATCH 2/2] Remove extra new line in case of SVN directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without the patch my prompt is (on 3 lines): [rousseau:~/Documents/sc/nfc/libnfc] svn ‡ With the patch my prompt is (on 1 line only): [rousseau:~/Documents/sc/nfc/libnfc] svn ‡ This is because expr(1) adds a new line at the end of the result. --- liquidprompt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/liquidprompt b/liquidprompt index e273352..7fa193f 100755 --- a/liquidprompt +++ b/liquidprompt @@ -677,13 +677,15 @@ _lp_svn_branch() [[ "$LP_ENABLE_SVN" != 1 ]] && return local root local url + local result eval $(LANG=C LC_ALL=C svn info 2>/dev/null | sed -n 's/^URL: \(.*\)/url="\1"/p;s/^Repository Root: \(.*\)/root="\1"/p' ) # Make url relative to root url="${url:${#root}}" if [[ "$url" == */trunk* ]] ; then echo trunk else - expr "$url" : '.*/branches/\([^/]*\)' || expr "$url" : '/\([^/]*\)' || basename "$root" + result=$(expr "$url" : '.*/branches/\([^/]*\)' || expr "$url" : '/\([^/]*\)' || basename "$root") + echo $result fi }