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 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置