Centos执行shell命令返回127错误

2019-08-11  本文已影响0人  nilzz

Centos执行shell命令返回127错误

解决方法

应该是运行环境和登录用户的运行环境存在差异造成的
在脚本执行之前,添加. /etc/profile,加载环境变量,问题解决

#!/bin/bash
. /etc/profile #脚本执行之前
#PHP
$cmd="sudo /www/wwwroot/uiw/shell/prt.sh";
system($cmd,$ret);
echo $ret; //返回1或者其他是失败 0是成功
上一篇 下一篇

猜你喜欢

热点阅读