home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!purdue!hsdndev!news.cs.umb.edu!mzraly
- From: mzraly@ra.cs.umb.edu (Michael S. Zraly)
- Newsgroups: comp.unix.questions
- Subject: Bourne shell read command
- Message-ID: <1992Jul24.213654.29656@cs.umb.edu>
- Date: 24 Jul 92 21:36:54 GMT
- Sender: news@cs.umb.edu (USENET News System)
- Organization: UMass/Boston Dept. of Math & CS
- Lines: 29
-
-
- I am looking to read a file containing lines of the form
-
- field1 field2 field3
-
- from a shell file, setting the variables mac to field2 and
- dir to field3 if field1 matches the variable abbrev.
-
- The following code does NOT work, but illustrates my meaning:
-
- # this does NOT work
- while (read x y z junk < $afile)
- do
- if test $x = $abbrev
- then
- mac=$y # 'export mac' doesn't help
- dir=$z
- fi
- done
-
- Does anyone have any ideas?
-
- Thanks,
- Mike
-
-
- --
- Mike Zraly Never attribute to malice that which
- mzraly@cs.umb.edu is adequately explained by stupidity.
-