twolfson / sexy-bash-prompt

Bash prompt with colors, git statuses, and git branches.
MIT License
1.14k stars 155 forks source link

Extra .bashrc being called from .profile #24

Closed llynix closed 10 years ago

llynix commented 10 years ago

Using Ubuntu I had to modify .profile to remove these lines: echo "# Trigger ~/.bashrc commands" >> "$PROFILE_SCRIPT_FULL" echo ". ~/.bashrc" >> "$PROFILE_SCRIPT_FULL"

bashrc was already called from .profile and this was causing an error. As a result after running this script and logging out of unity, I could not log back into unity until this was removed.

Hope this makes sense, thanks for the great prompt.

twolfson commented 10 years ago

Oooh, that's a nice circular loop. What version of Ubuntu are you running so I can reproduce?

llynix commented 10 years ago

$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.04.4 LTS Release: 12.04 Codename: precise

These are the lines in .profile that call it already:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi
twolfson commented 10 years ago

Cool, thanks! I will take a look at this by the end of the weekend.

twolfson commented 10 years ago

Alright, I have successfully reproduced the bug via a fresh VM. I will be mulling over the options for a bit.

twolfson commented 10 years ago

I would like to attack this in 2 parts.

  1. Add a conservative check that does not add new lines to .bash_profile, .bash_login, or .profile if there is already comments about .bashrc.
  2. We are getting so far because the check script in install.sh is failing to identify that sexy-bash-prompt was successfully installed. This is being caused by a practical line in the Ubuntu .bashrc which exits early if $PS1 is not defined.
twolfson commented 10 years ago

It looks like a -i to make it run as an interactive shell fixes it right up.

twolfson commented 10 years ago

Additionally, no conflicts with OSX (as tested via Sauce Labs). I am still going to introduce the conservative portion in shortly after.

twolfson commented 10 years ago

Closing as released in 0.17.0. Still following up on conservative portion.

twolfson commented 10 years ago

Alright, the conservative work is on bug/prevent.infinite.loops and looks good on Ubuntu.

I am tired so I am going to revisit this when I am more awake to make sure it isn't extreme.

twolfson commented 10 years ago

Tested on OSX via Sauce Labs, looks good as well.

twolfson commented 10 years ago

Alright, the conservative install has been introduced in 0.18.0.