csh: still trying to read file
Maarten Litmaath
maart at cs.vu.nl
Thu Mar 30 01:39:44 AEST 1989
pklammer at 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 at cs.vu.nl, mcvax!botter!maart
More information about the Comp.unix.questions
mailing list