[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shell script reading stdin?



On Sat, Jun 10, 2000 at 10:54:32PM -0400, Mike Werner wrote:
> What I couldn't find was *any* mention of was how to *use* stdin from
> within a shell script.  Anyone here ever done anything like this?


Yes, but this may or may not be suitable for whatever you're doing.  As
an example, this would take stdin and pipe it to tr.

#!/bin/sh

cat | tar [A-Z] [a-z]


There are probably better ways (which I'd also be interested in
knowing).  :)

Fwiw, you could use "exec cat" instead of "cat" if you needed the shell
to persist after the cat invocation, but that's a different story.

Maybe if you posted what you're trying to do, some better ways of doing
it might come to light?

HTH.



Reply to: