From dba9fd867350c9203bf93ef485c89e0dcc5197d2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 9 Jun 2015 14:19:10 +1200 Subject: Allow PROMPT_PREFIX and PROMPT_SUFFIX Also break the prompt definition into multiple lines for readability --- bash/bashrc.d/prompt.bash | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'bash/bashrc.d') diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 7b12a2a2..68c8eb37 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -12,9 +12,18 @@ prompt() { # Turn complex, colored PS1 and debugging PS4 prompts on on) - # Set up pre-prompt command and prompt format + # Set up pre-prompt command PROMPT_COMMAND='declare -i PROMPT_RETURN=$? ; history -a' - PS1='[\u@\h:\w]$(prompt job)$(prompt vcs)$(prompt ret)\$' + + # Set up prompt, including optional PROMPT_PREFIX and PROMPT_SUFFIX + # variables + PS1='[\u@\h:\w]' + PS1=$PS1'$(prompt job)' + PS1=$PS1'$(prompt vcs)' + PS1=$PS1'$(prompt ret)' + PS1='$PROMPT_PREFIX'$PS1 + PS1=$PS1'$PROMPT_SUFFIX' + PS1=$PS1'\$' # If Bash 4.0 is available, trim very long paths in prompt if ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} >= 4)) ; then -- cgit v1.2.3