shell:

#!/bin/bash
#==========================================================
# this example show you how to get data from pipe
#==========================================================
while read line
do
    echo $line
done

 

php:

#!/usr/bin/env php
<?php
#========================================================
#testing how to get data from pipe
#========================================================
$fp=fopen('php://stdin','r');
$result='';
while(!feof($fp)){
    $result.=fgets($fp,128);
}
fclose($fp);

echo $result;

python:

#!/usr/bin/env python
#coding:utf-8
import sys

#line=sys.stdin.readline()
#while line:
#    print line
#    line=sys.stdin.readline()
while True:
    line=sys.stdin.readline()
    if not line:
        break
    print line

 

相关文章:

  • 2022-12-23
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2021-10-01
  • 2021-09-28
  • 2022-01-15
猜你喜欢
  • 2021-06-28
  • 2021-08-17
  • 2021-08-10
  • 2022-02-28
  • 2021-05-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案