Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!uunet!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.shell Subject: Re: How can I read from a file in the csh (or tcsh)? Message-ID: <1991Jun03.234254.7990@convex.com> Date: 3 Jun 91 23:42:54 GMT Article-I.D.: convex.1991Jun03.234254.7990 References: <1991Jun3.211419.22042@spool.cs.wisc.edu> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Distribution: usa Organization: CONVEX Software Development, Richardson, TX Lines: 46 Nntp-Posting-Host: pixel.convex.com From the keyboard of fagan@green.cs.wisc.edu (Michael S. Fagan): :How can I read from a file in the csh (or tcsh) from within a script? :I can do it from standard input by saying: : :set temp = $< : :but, I can't seem to figure out how to do it from a file other than :having the file redirected as input. Well, you *COULD* hack together something with something like set noglob @ lineno = 1 set line = (`sed -ne ${lineno}p file`) @ lineno ++ But I ardently implore you to reconsider using a csh derivative for whatever task you have before you. Most people who have tried to use csh as a scripting language have lived to regret this deed. Those who haven't are dead. If you're using ksh, it's pretty easy to use temporary descriptors to read from various files, like exec 3