无法以 root 用户身份在 centos 上执行 datediff 命令?

Unable to execute datediff command on centos as root user?

我无法在 centos 上以 root 用户身份 运行 datediff 命令。但是作为其他用户,我可以 运行 命令。你们能帮我解决这个问题吗?

仅供参考,我使用的是这个版本 centos-release-7-0.1406.el7.centos.2.5.x86_64

检查您的 $PATH 变量,对于您的 root 用户,该命令的目录可能不在其中。

echo $PATH

会显示当前值,datediff命令的目录必须出现在那里。要修改,请执行:

export PATH=$PATH:<THE DIRECTORY>

要查找 datediff 在您的系统上的位置,当您连接到除 root 以外的其他用户时,执行:

which datediff