且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么找不到 sudo: bundle 命令?

更新时间:2023-11-17 19:23:58

检查 PATH 是否在有和没有 sudo 的情况下具有相同的值.显然它找不到 bundle 只是因为它没有在 PATH

Check if the PATH has the same values both with and without sudo. Apparently it cannot find bundle just because it is not listed in PATH

您可以比较以下两行的输出

You can compare the outputs of following two lines

$ echo 'echo $PATH' | sh
$ echo 'echo $PATH' | sudo sh

理想情况下,sudo 应该保持 PATH 不变.但这可能是您的托管分布的一个附带问题.

Ideally sudo is supposed to leave PATH untouched. But this might be a side issue of your hosting distribution.

由原始海报编辑.输出是:

Edit by original poster. Output is:

[root@desktop etc]# echo 'echo $PATH' | sh
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@desktop etc]# echo 'echo $PATH' | sudo sh
/sbin:/bin:/usr/sbin:/usr/bin:/user/local/bin
[root@desktop etc]#