RE: [PHP] Piping and the CLI parser
| From: | Ford, Mike [LSS] | Date: | Wed, 06 Aug 2003 14:35:23 +0000 |
| Subject: | RE: [PHP] Piping and the CLI parser | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-158478@lists.php.net to get a copy of this message | ||
On 06 August 2003 15:19, Jason Wong wrote:
> On Wednesday 06 August 2003 21:29, Nicolas Frisby wrote:
>
> > Regardless of that, do you know anything of how the piping mechanism
> > works?
>
> Not really. I do know that what you're trying to do doesn't work for
> bash scripts either. IE you cannot use a pipe to pass command line
> arguments to a bash script, nor a php script.
Well, no -- command line arguments are not STDIN, as a general rule. That's
why they're passed separately in argc, argv.
When you pipe one process into another:
x | y
the standard output (STDOUT) of x is "piped" directly into the standard
input (STDIN) of y -- so whatever x sends to STDOUT, y will see on STDIN.
The mechanics of this aren't really important (although commonly x's STDOUT
is written to a tempfile, which y's STDIN is then read from), so long as you
understand the principles of it.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211