Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 some php scrits in a subfolder and want to run some of them (found by a regular expression) via command line.

Here is what I have so far:

find . -name email[^T]*\.php -print0 | xargs -0 -t -r /usr/local/bin/php

unfortunately only the first php script is executed.

Is there a way to tell xargs to execute the /usr/local/bin/php command on a per file basis?

Regards

Jeremy

share|improve this question
up vote 2 down vote accepted

You need to tell xargs to only pass a single argument to the command by using -n 1.

Or you could just use -exec ... \; in find.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .