Re^2: csh: still trying to read file

Maarten Litmaath maart at cs.vu.nl
Mon Apr 3 14:25:40 AEST 1989


jms at hcx.uucp (Michael Stanley) writes:
\...  Keep a variable which
\is the number of the next line you plan to read.  Each time you read
\a line, you can add one to it.  Now, knowing the line number, how do I
\get that line from a file...  Try this:

\	set file_name = "TESTFILE"
\	set line_no = "5"
\	set line_buff = `sed -n "${line_no}p" $file_name`
\	echo $line_buff

So for every line you must skip n - 1 lines first!
Furthermore: how are you going to distinguish eof from empty lines?

\...
\	setenv PATH "/bin:/usr/bin:/usr/local:~yourid/bin"

By this scheme any subcommand that invokes execvp() one way or the other,
will `fail': the environment variable is LITERALLY set to the above, that is,
including the tilde, and the directory "~yourid" isn't the directory you
intended to include (and it probably doesn't exist).
Use `set path=(...)' or `setenv PATH ...$HOME/bin'. RTFM.
Furthermore "~yourid/bin" ("~/bin", for insiders :-) should be the FIRST
directory in your PATH.
-- 
 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