Re: bash prompt evaporates in subdirectories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 On Thursday, October 24, 2024 at 02:46:21 PM GMT+3, avih <avihpit@xxxxxxxxx> wrote:
> ...
>
> I tried the following:
>
> ...
>
> 2. In a terminal (default shell is bash 5.2.37(1)):
>    sudo zypper install git  # 2.47.0-1.1
>    sudo zypper install bash-git-prompt
>
> 3. The above does NOT install git-prompt.sh which is maintained
>    together with git at the contrib dir. In its README.md:
>    ...
>
> 4.  Download git-prompt.sh from the git contrib dir:
>       curl -o ~/git-prompt.sh https://raw.githubusercontent.com/git/git/refs/tags/v2.47.0/contrib/completion/git-prompt.sh
>       chmod +x ~/git-prompt.sh

> 5. Add the following lines at the end of ~/.bashrc :
>      . ~/git-prompt.sh
>      PS1='\w$(__git_ps1)\n\$ '

Actually, "sudo zypper install git" does install the correct script
at /usr/share/bash-completion/completions/git-prompt.sh

Additionally, that "git" package adds /etc/bash-completion.d/git-prompt
which does source this script automatically on shell startup, therefore
step 4 (the curl thing) is not required, and git-prompt.sh is already
loaded automatically, and so only one line instead of two should be
added to ~/.bashrc (as a minimal example):

  PS1='\w$(__git_ps1)\n\$ '

The rest is the same. Still can't reproduce it with this script.

avih





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux