Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: easy way to read from stdin ?



On Jun 23,  4:37pm, Sweth Chandramouli wrote:
} Subject: easy way to read from stdin ?
}
} 	this is probably just going to show my colossal cluelessness, but is 
} there an easy way to get a zsh script to read from standard input?

It should be reading everything except the commands themselves from the
standard input "by default."  However, I'm puzzled when you say:

} ... rather than reading input from a file ...

What is it that you are doing to cause it to read from a file?  That is,
when it's not a cgi, how do you run it?

} i tried a 
} "while read ... ; do ... done" loop with no redirection of input, but that 
} didn't seem to work right.

How exactly did it not work?  What, if any, flags are you passing to read?
(For example, the -q flag will forcibly open /dev/tty ....)

} what am i missing here?

You can try "read -u0 ..." to force the input to come from file descriptor
zero, but I don't know why that would be necessary.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author