Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re: csh: still trying to read file Keywords: csh C shell read programming unix Message-ID: <2225@solo2.cs.vu.nl> Date: 29 Mar 89 15:39:44 GMT References: <2130@pikes.Colorado.EDU> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 25 pklammer@pikes.Colorado.EDU (Peter Klammer) writes: \... what I want is to read a file a line at a time in the \midst of a csh script that is in dialogue; that is, redirecting \stdin is not acceptable. You don't want csh scripts, if you want to avoid problems. Use sh scripts: i=0 exec 3< foo while read bar <&3 do i=`expr $i + 1` echo "line $i: $bar" done \... Another csh mystery (at least until I get my book, maybe): if I prepare \a csh script file (with the mandatory "#" on line 1) and chmod +x it, \and then invoke it from a subdirectory, it is run from my HOME directory! ... Probably there's a cd command in your .cshrc. Furthermore, try if your kernel recognizes `#!/bin/csh -f' on line 1. -- Modeless editors and strong typing: |Maarten Litmaath @ VU Amsterdam: both for people with weak memories. |maart@cs.vu.nl, mcvax!botter!maart