How to fix the prompt?
christophe lalanne
chl at aliquote.org
Thu Sep 1 17:55:31 UTC 2022
It looks weird because /etc/profile is for login shell, not interactive
ones. Can't you define your PS1 prompt in your $HOME/.bashrc instead? Or
check out https://starship.rs/.
As for Tmux, please ensure that new panes are not login shell. This is
easily fixed using
set -g default-command "${SHELL}"
On 2022-08-31 20:32, jian he wrote:
>
>Hi there.
>
>The following script is trying to change the prompt. part of /etc/profile.
>The problem is I need to source /etc/profile every time I open a new pane in
>tmux.
>Is there any simple way to change the prompt permanently?
>
>if [ "${PS1-}" ]; then
> if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
> # The file bash.bashrc already sets the default PS1.
> # PS1='\h:\w\$ '
> if [ -f /etc/bash.bashrc ]; then
> . /etc/bash.bashrc
> fi
> else
> if [ "$(id -u)" -eq 0 ]; then
> PS1='# '
> else
> PS1='$ '
> fi
> fi
>fi
>
>if [ -d /etc/profile.d ]; then
> for i in /etc/profile.d/*.sh; do
> if [ -r $i ]; then
> . $i
> fi
> done
> unset i
>fi
>
>------
>version info:
>No LSB modules are available.
>Distributor ID: Ubuntu
>Description: Ubuntu 22.04.1 LTS
>Release: 22.04
>Codename: jammy
>-------
>
>--
> I recommend David Deutsch's <<The Beginning of Infinity>>
>
> Jian
>
>
>--
>ubuntu-users mailing list
>ubuntu-users at lists.ubuntu.com
>Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
--
christophe lalanne
152E3E3F7C4CCE44
www.aliquote.org
More information about the ubuntu-users
mailing list