3

I have added the following code to my .bashrc file so that I do not see the path in my terminal.

# Programster Injection
# Here we can choose the mode for displaying the current path in bash terminal.
# 1 = normal path shown
# 2 = only current directory
# 3 = no path at all.
DISPLAY_OPTION=3

if [ "$DISPLAY_OPTION" = 1 ]; then
    PATH_VAR="\w"
elif [ "$DISPLAY_OPTION" = 2 ]; then
    PATH_VAR="\W"
elif [ "$DISPLAY_OPTION" = 3 ]; then
    PATH_VAR=""
fi


if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]'$PATH_VAR'\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:'$PATH_VAR'\$ '
fi

As you can see, the \w in the PS1 environment variable is what is responsible for setting the display of the path. When I open byobu, the PS1 variable is changed from:

\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\[\033[00m\]\$

to:

\[\e[38;5;202m\]$(byobu_prompt_status)\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;172m\]\h\[\e[00m\]:\[\e[38;5;5m\]\w\[\e[00m\]$(byobu_prompt_symbol)

I actually quite like the rest of the formatting that byobu adds, so how do I make it so that whenever I open byobu, it will now set PS1 to:

PS1='\[\e[38;5;202m\]$(byobu_prompt_status)\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;172m\]\h\[\e[00m\]:\[\e[38;5;5m\]\[\e[00m\]$(byobu_prompt_symbol) '

which is the same, but without the \w.

1 Answer 1

1

so I technically came here to find an answer but was surprised there is none. Nevertheless, it did somehow motivate me to look a bit further and I found out byobu gets its prompt from /usr/share/byobu/profiles/bashrc

2
  • 1
    better late than never. Thank you :) Feb 4, 2021 at 8:25
  • you're welcome @Programster :)
    – Fuseteam
    Feb 7, 2021 at 18:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .