note 96117 added to features.commandline

From: Date: Tue, 09 Feb 2010 16:38:16 +0000
Subject: note 96117 added to features.commandline
Groups: php.notes 
Request: Send a blank email to php-notes+get-165802@lists.php.net to get a copy of this message
To place a php-script in a pipe you can use: xargs -d "\n" ./mysrcipt.php --foo With many lines/args the ./myscript.php will be called a couple times, but always with --foo. e.g.: ./myscript.php: #!/bin/php <?php foreach($args as $key => $value){ echo "\n".$key.":".$value; } ?> cat -n1000 /path/file | xargs -d "\n" ./myscript.php --foo | less will call the script two times with echo to stdout/less: 0:./myscript 1:--foo 2:[file-line1] 3:[file-line2] ... 800:[file-line799] 0:./myscript 1:--foo 2:[file-line800] ... ---- Server IP: 69.147.83.197 Probable Submitter: 62.245.179.106 ---- Manual Page -- http://www.php.net/manual/en/features.commandline.php Edit -- https://master.php.net/note/edit/96117 Del: integrated -- https://master.php.net/note/delete/96117/integrated Del: useless -- https://master.php.net/note/delete/96117/useless Del: bad code -- https://master.php.net/note/delete/96117/bad+code Del: spam -- https://master.php.net/note/delete/96117/spam Del: non-english -- https://master.php.net/note/delete/96117/non-english Del: in docs -- https://master.php.net/note/delete/96117/in+docs Del: other reasons-- https://master.php.net/note/delete/96117 Reject -- https://master.php.net/note/reject/96117 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165802) next »