Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash Ubuntu外壳脚本路径变量_Bash_Shell_Path_Cron_Crontab - Fatal编程技术网

Bash Ubuntu外壳脚本路径变量

Bash Ubuntu外壳脚本路径变量,bash,shell,path,cron,crontab,Bash,Shell,Path,Cron,Crontab,我从crontab调用了下面的shell脚本,在它调用包含wget或find等shell命令的php代码之前,它工作得很好 #!/bin/sh PATH=/opt/server/php/bin:/usr/bin/wget:/bin/egrep:/usr/bin/find cd /opt/server/apache2/htdocs/webapp/ php oil refine job:handler 对于每个命令,我都执行一个查找路径的命令,然后将其添加到path变量中。然而,它没有找到命令,

我从crontab调用了下面的shell脚本,在它调用包含wget或find等shell命令的php代码之前,它工作得很好

#!/bin/sh
PATH=/opt/server/php/bin:/usr/bin/wget:/bin/egrep:/usr/bin/find
cd /opt/server/apache2/htdocs/webapp/ 
php oil refine job:handler
对于每个命令,我都执行一个查找路径的命令,然后将其添加到path变量中。然而,它没有找到命令,我得到如下消息:

sh: wget: not found
sh: find: not found

我该如何解决这个问题?我知道这是一个常见的问题,但是我在stackoverflow上没有找到一个很好的解释。另外:我知道从bash调用脚本与从crontab调用脚本可能会导致不同的环境设置,但我也会得到这些错误。

好的先生,
路径是一个字符串,它描述了包含可执行文件的目录,而不是可执行文件本身

也许可以用这样的东西

PATH=/opt/server/php/bin:/usr/bin:/bin

很好,先生,
路径
是一个字符串,用于描述包含可执行文件的目录,而不是可执行文件本身

也许可以用这样的东西

PATH=/opt/server/php/bin:/usr/bin:/bin