Jim Breton <[EMAIL PROTECTED]> wrote: >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). :)
Well, stdin sort of tends to happen automatically. For instance, this would also take stdin and pipe it to tr: #! /bin/sh tr [A-Z] [a-z] If you need to send stdin straight to a file, then 'cat > filename' is the easiest way to do it, though; trying to use just '> filename' there will truncate 'filename' to a zero-length file. -- Colin Watson [EMAIL PROTECTED]