|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-12-05 08:30 UTC] arne at fotos dot dyndns dot biz
Description:
------------
when I have 2 files t and t2 and I try to diff them with
diff <(cat t) <(cat t2) LINUX-shell produces 2 meta-files (/dev/fd/[00-99]) to pipe into the diff command. Thats usual, thats basic.
If I try to use the same command in passthru("diff <(cat t) <(cat t2)"); I run into errors:
sh: -c: line 1: syntax error near unexpected token '('
sh: -c: line 1: 'diff <(cat t) <(cat t2)'
The files are in the PATH and I can see output of t when I do: passthru("cat t"); what means that cat is available too.
Reproduce code:
---------------
file X.php4:
-----snip--------
<?php passthru("diff <(cat t) <(cat t2)"); ?>
-------snap------
shell:> php X.php4
Expected result:
----------------
1,3c1,4
< MIKE
< bravo
< charly
---
> VANDA
> PHP
> Utah
> russia
Actual result:
--------------
sh: -c: line 1: syntax error near unexpected token '('
sh: -c: line 1: 'diff <(cat t) <(cat t2)'
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 00:00:01 2025 UTC |
You cannot pipe data into programs executed by PHP. Just do passthru("diff t t2");well, I can, because this works: passthru("cat t | diff - t2"); that means just a pipe stack (or anything else) seems to be corrupt BRgds, Arne