-bash:__git_ps1:命令未找到 [英] -bash: __git_ps1: command not found

查看:3444
本文介绍了-bash:__git_ps1:命令未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图安装Ruby 2.0。 urped现在我的命令行如下所示:

I tried to install Ruby 2.0. My command line urped and now looks like the following:

-bash: __git_ps1: command not found
[11:58:28][whatever@whatever ~]$ 

我还没有线索如何摆脱没有发现错误__git_ps1命令。我搜索我的.bash_profile和我的.bashrc,看看它试图设置一个变量或东西,我没有看到任何东西。我能找到提到git_ps1唯一的地方是在〜/ .dotfiles / .bash_prompt。我替换该文件的内容完全,注销并重新登录,并修复了什么。

I have not a clue how to get rid of the __git_ps1 command not found error. I've searched my .bash_profile and my .bashrc to see if it's trying to set a variable or something and am not seeing anything. The only place I can find git_ps1 mentioned is in ~/.dotfiles/.bash_prompt. I replace the content of that file completely, logout and log back in and it fixes nothing.

我看到​​这,但我pretty新命令行,所以我只是困惑自己。

I saw this, but I'm pretty new to command line so I just confused myself.

任何想法?

推荐答案

BASH有​​自动设置你的提示,给你不错的信息的方式整体转换。您可以通过设置 PS1 环境变量设置提示。例如,如果设置了 PS1 =$我的提示会是这样的:

BASH has a whole slew of ways of automatically setting your prompt to give you nice information. You set the prompt by setting the PS1 environment variable. For example, if I set PS1="$ " my prompt will look like this:

$ 

不是太丰富。我能说的是,在命令行中,这促使我。

Not too informative. All I can tell is that the command line is prompting me.

不过,如果我设置 PS1 = \\ü@ \\ H:\\ W $ ,我现在的提示会是这样的:

However, If I set PS1=\u@\h: \w$, my prompt will now look like this:

david@vegibank:/usr/bin$ 

这告诉我,我怎么登录(即 \\ U ),机器我到( \\ ^ h ),我在(即 \\我的目录是W )。如果我使用混帐,这将是很好,如果混帐分支我在也是我提示的一部分。

That tells me how I'm logged in (the \u), the machine I'm onto (\h), and the directory I'm in (the \w). If I use git, it would be nice if the git branch I'm in is also part of my prompt.

这是到底是怎么回事与你的 .profile文件,您的.bashrc 文件,你的 .bash_login文件的.bash_profile 脚本。或者说,什么样的一些系统管理员的确在 / etc / profile文件

This is exactly what is going on with your .profile, your .bashrc file, your .bash_login or your .bash_profile script. Or, what some system admin did in /etc/profile.

有一对夫妇的事情可以做。或者:

There are a couple things you can do. Either:


  • 下载缺少的 __ git_ps1 ,并确保它在你的 $ PATH 环境变量(这是由组合集上面提到的各种初始化文件)

  • 更改正在执行任何初始化文件中的 PS1 环境变量(我相信它可能是的.bash_profile

  • Download the missing __git_ps1 and make sure it's in your $PATH environment variable (which is set by a combination of the various initialization files mentioned above)
  • Change your PS1 environment variable in whatever initialization file is being executed (I believe it is probably .bash_profile.

只需添加这是最后一行:

Just add this as the last line:

PS1="\u@\h:\w\n$ "

添加的 \\ n 打印就行了美元符号提示如下所示:

The added \n prints the dollar sign prompt on the line below like this:

david@vegibank:/usr/bin
$ 

我喜欢这样做,因为提示可以得到相当长,当提示长于30到50个字符编辑命令行变得棘手。否则,它是pretty多标准提示,大多数用户使用。你可以看到更多在手册页了解设置BASH提示。 (搜索单词提示该网页上)。

I like to do that because the prompt can get rather long and editing the command line gets tricky when the prompt is longer than 30 to 50 characters. Otherwise, it's pretty much the standard prompt that most users use. You can see more about setting BASH prompts in the man pages. (Search for the word Prompting on that page).

如果你发现它有点混乱,是你不使用Kornshell高兴。我用Kornshell,并获得相同的提示 PS1 = \\ü@ \\ H:\\ W \\ N $ 呢,我把我的提示是:

If you find it a bit confusing, be glad you're not using Kornshell. I use Kornshell and to get the same prompt PS1=\u@\h:\w\n$ does, I set my prompt as:

export PS1='$(print -n "`logname`@`hostname`:";if [[ "${PWD#$HOME}" != "$PWD" ]] then; print -n "~${PWD#$HOME}"; else; print -n "$PWD";fi;print "\n$ ")'

这篇关于-bash:__git_ps1:命令未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆