shell脚本在命令行上执行正常,但不能从cron作业执行

我有一个非常简单的class轮update_pot.sh

find . -iname "*.php" | xargs xgettext -olocale/messages.pot --from-code=UTF-8 -j 

如果从提示符运行./update_pot.sh它工作文件。 但是当我从一个cron作业调用它返回

 xgettext: no input file given Try `xgettext --help' for more information. 

我试着把#! / bin / sh的第一行,但没有改变。

它可能是从错误的目录运行。 将cd放到脚本开头的正确目录中,或者将find改为使用绝对path。

我总是尝试没有像这样的环境相同的命令

 env - find . -iname "*.php" | xargs xgettext -olocale/messages.pot --from-code=UTF-8 -j 

但是Cakemox是正确的 – 你应该指定find的path