stdin -> stdout

Jorgen Grahn jgrahn-nntq at algonet.se
Sat Aug 20 05:42:46 EDT 2005


On Fri, 19 Aug 2005 15:26:27 GMT, max(01)* <max2 at fisso.casa> wrote:
> hi.
>
> i was wondering, what's the simplest way to echo the standard input to 
> the standard output, with no modification.
>
> i came up with:
...
> but i guess there must be a simpler way.
>
> using bash i simply do 'cat', *sigh*!
...
> ps: in perl you ca do this:
>
> ...
> while ($line = <STDIN>)
>    {
>      print STDOUT ("$line");
>    }
> ...

Actually, in perl it's easier than that, if you can tolerate that it also
filters file(s) given on the command-line:

  while(<>) {
     print;
  }

or even:

  #!/usr/bin/perl -p
  ;

Of course, not every programming language needs to have easy-to-use
filtering capabilities at the core.

/Jorgen

-- 
  // Jorgen Grahn <jgrahn@       Ph'nglui mglw'nafh Cthulhu
\X/                algonet.se>   R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list