I have a very simple one liner update_pot.sh

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

it works file if run ./update_pot.sh from prompt. but when i call from a cron job it returns

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

I tried putting #! /bin/sh for the first line but no change.

link|improve this question
feedback

2 Answers

up vote 2 down vote accepted

It is probably running from the wrong directory. Put a cd to the correct directory at the beginning of the script or change the find to use an absolute path.

link|improve this answer
1  
You could also change find . to find /path/to/starting/directory – Iain Jan 20 '11 at 13:53
yes it was the path.I added a cd $(dirname $0) at the beginning. I purposely left the path . in the find so the the script which is part of a php application will work no matter where the whole directory is copied or moved. – Grant M Jan 22 '11 at 4:57
feedback

I always try the same command with no environment like

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

but Cakemox is right - you should specify the path to find

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.