doufangpian5545 2019-02-10 22:07
浏览 292
已采纳

在PATH中执行bin,但是“执行版本”失败

How can I use go using the standard installation instructions in bash? What do I do wrong?

I followed the installation instructions for go on Linux. Therefore I downloaded the go tar.gz, untared it to /usr/local and added export PATH=$PATH:/usr/local/go/bin to /etc/bash.bashrc and made a source /etc/bash.bashrc.

However, go version does not give the proper result. See:

user@machine:~$ which go
/usr/local/go/bin/go
user@machine:~$ go version
user@machine:~$ /usr/local/go/bin/go version
go version go1.11.5 linux/amd64

user@machine:~$ type -a go
go is a function.
go () 
{ 
    eval dir=\$$1;
    cd "$dir"
}
go is /usr/local/go/bin/go
  • 写回答

1条回答 默认 最新

  • dqyuipw44576 2019-02-10 22:31
    关注

    Shell functions take priority over commands in your $PATH.

    which doesn't necessarily find shell functions (in fact I don't think it can find them at all). type -a is more reliable, at least if you're using bash or another sh-derived shell.

    The problem is that you have an unrelated shell function called go.

    If you still want that function, I suggest giving it a different name, Go would work.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持