File tree Expand file tree Collapse file tree 1 file changed +2
-13
lines changed
files/0-system/etc/profile.d Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change 1- # Taken from secureblue
2- # https://github.com/secureblue/secureblue/blob/live/files/system/etc/profile.d/xx-bash-prompt-command.sh
31#! /usr/bin/bash
42# Filename needs to be alphabetically later than vte.sh
53if [ -n " ${BASH_VERSION:- } " ]; then
6- export PROMPT_COMMAND=' __bash_prompt_command 2>/dev/null'
7-
8- __bash_prompt_command () {
9- local prev_status=" $? "
10- if [ " $prev_status " != 0 ]; then
11- # Print nonzero exit code in bold red text inside square brackets
12- printf ' \033[31m[\033[1m%s\033[22m]\033[39m' " $prev_status "
13- fi
14- # Default prompt taken from /etc/bashrc
15- printf ' \033]0;%s@%s:%s\007' " ${USER} " " ${HOSTNAME%% .* } " " ${PWD/# $HOME / \~ } "
16- }
4+ # Print nonzero exit codes in bold red text inside square brackets at beginning of prompt
5+ export PS1=' $(code=${?#0};echo -n "${code:+\[\e[31m\][\[\e[1m\]${code}\[\e[22m\]]\[\e[39m\]}")' " ${PS1} "
176fi
You can’t perform that action at this time.
0 commit comments