From 948d7186089b915704df2f0b0f48fd8508db077b Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Mon, 15 Aug 2005 16:18:15 +0000 Subject: [PATCH] Preserve PROMPT_xx_COLOUR if already set. Users can override the colours. git-svn-id: https://svn.cambridge.iain.cx/profile/trunk@5 6be0d1a5-5cfe-0310-89b6-964be062b18b --- .profile.d/ps1.bashrc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.profile.d/ps1.bashrc b/.profile.d/ps1.bashrc index 6f81794..bb05253 100644 --- a/.profile.d/ps1.bashrc +++ b/.profile.d/ps1.bashrc @@ -1,15 +1,18 @@ # $Id$ -# VERSION 1.2 (2001-10-31) +# VERSION 1.3 (2005-08-15) # -# coloured prompts for bash +# Coloured prompts for bash. # -# prompt is user@host:/dir$ where host is highlighted in green if the last -# command exited 0 or in red (followed by the error code) otherwise +# Prompt is user@host:/dir$ where host is highlighted in green if the last +# command exited 0 or in red (followed by the error code) otherwise. # -# to use, add a call to __ps1 in your .bash_profile +# Override the PROMPT_OK_COLOUR and PROMPT_FAILED_COLOUR environment variables +# to set different colours. +# +# To use, add a call to __ps1 in your .bash_profile. -export PROMPT_OK_COLOUR=32 -export PROMPT_FAILED_COLOUR=31 +export PROMPT_OK_COLOUR=${PROMPT_OK_COLOUR:-32} +export PROMPT_FAILED_COLOUR=${PROMPT_OK_COLOUR:-31} function __ps1() { export PS1='\u@\[\033[1;$(__ps1_col $?)m\]\h\[\033[0m\]$(__ps1_ret $?):\w\$ ' -- 2.7.4