Skip to content

__git_ps1: command not found #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
felipesabino opened this issue Aug 12, 2013 · 2 comments
Open

__git_ps1: command not found #21

felipesabino opened this issue Aug 12, 2013 · 2 comments

Comments

@felipesabino
Copy link

I use bash_completion for my terminal, and I may have to dive deeper into the code implementation to be sure, but this might be related to the known issue about rvm

I load my profile files by the following script on top of my .bash_profile

# Load files
for file in ~/.{bash_prompt,exports,aliases,functions}; do
  [ -r "$file" ] && source "$file"
done
unset file

And .bash_prompt is one of them that seems to raise the error

# GIT

if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
fi

# PS1

RESET="\[\017\]"
NORMAL="\[\033[0m\]"
RED="\[\033[31;1m\]"
YELLOW="\[\033[33;1m\]"
WHITE="\[\033[37;1m\]"
SELECT="if [ \$? = 0 ]; then echo \"${YELLOW}\"; else echo \"${RED}\"; fi"


#export PS1="\w \[\033[0;33m\]$(__git_ps1) \[\033[0m\] >$ "
export PS1="${RESET} \`${SELECT}\`\w ${WHITE}\$(__git_ps1) ${NORMAL}\$ "

and the buggy showterm.io as an example: http://showterm.io/6ef68371dc1176074c302


Mac OS 10.8.4
iTerm 1.0.0.20130622
bash-completion 1.3

@andersonshatch
Copy link

Same happens for me.

It's because if you don't specify a program to start, it uses your shell, but doesn't start it up as a login shell, so .bash_profile and the files necessary for bash completion (where the function __git_ps1 is declared) don't get loaded.

As a workaround you can run showterm $SHELL -l

@ConradIrwin
Copy link
Owner

Yeah, I think this needs fixing. I'm not sure if there are any downsides to
running a login shell — it might be a bit slower?

On Thu, Nov 7, 2013 at 12:51 PM, Josh Anderson [email protected]:

Same happens for me.

It's because if you don't specify a program to start, it uses your shell,
but doesn't start it up as a login shell, so .bash_profile and the files
necessary for bash completion (where the function __git_ps1 is declared)
don't get loaded.

As a workaround you can run showterm $SHELL -l


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-28005129
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants