Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Dec 082010
 

Validate the syntax of PHP files in a directory

Answer:

To validate the syntax of PHP files in a directory, to check if any syntax error so we can fix them before they really happen at runtime.

You would need to have the GNU parallel installed in order to use the command below.

# find -type f -name '*.php' | parallel php -l

Dec 062010
 

Executing jobs in parallel using GNU parallel

Answer:

GNU parallel is a tool for executing jobs in parallel. It is not part of standard Linux distribution yet, so it is so worth to install it.

You can download the latest version from: http://ftp.gnu.org/gnu/parallel/

E.g.

# wget http://ftp.gnu.org/gnu/parallel/parallel-20101202.tar.bz2
# tar -jxvf parallel-20101202.tar.bz2
# cd parallel-20101202
# ./configure
# make && sudo make install

Example usages:

#  echo -e "a\nb\nc"  | parallel echo "foo"

foo a
foo b
foo c