Re: question about using temporary named pipe in the string for system
| From: | Robin Vickery | Date: | Thu, 11 May 2006 10:33:54 +0000 |
| Subject: | Re: question about using temporary named pipe in the string for system | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235972@lists.php.net to get a copy of this message | ||
On 11/05/06, Jochem Maas <jochem@iamjochem.com> wrote:
Ginger Cheng wrote: Hello, PHP gurus,That's exactly what's causing it. One thing the OP can do is invoke bash to run his command line: $cmd = '/bin/bash -c "paste <(cut -f1 file1) <(cut -f2 file2) > file3"'; Alternatively, arrange the command line more efficiently: $cmd = 'paste file1 file2 | cut -f1,6 > file3'; (replacing the '6' with the correct field number) -robinI have a command that I want to run using system function. Thecommand exploits temporary named pipes in the place of temporary files.my command is paste <(cut -f1 file1) <(cut -f2 file2) > final_fileIt works perfectly well if I just type it in my interactiveshell. But if I do a<?php $cmd = " paste <(cut -f1 file1) <(cut -f2 file2) >final_file"; system($cmd); ?>I got the syntax error msg as"sh: -c: line 1: syntax error near unexpected token `('". I have tried I notice that the 'sh' shell is being used according to your error output, I'm guessing that maybe your interactive shell is running something like 'bash' and that this discrepency might the root cause of the problem. just a guess - I don't know how you would define another shell for php to use either :-/..