Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a very simple one liner

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

it works file if run ./ 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.

share|improve this question
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.

share|improve this answer
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

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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