Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!bellcore!faline!scherzo!allegra!mit-eddie!husc6!seismo!mcvax!enea!tut!intrin!jty From: jty@intrin.UUCP Newsgroups: comp.unix.wizards Subject: Re: Shell & IFS Message-ID: <504@intrin.UUCP> Date: Tue, 3-Mar-87 05:16:27 EST Article-I.D.: intrin.504 Posted: Tue Mar 3 05:16:27 1987 Date-Received: Sat, 7-Mar-87 00:24:25 EST References: <4560@brl-adm.ARPA> <140@tdi2.UUCP> Reply-To: jty@intrin.UUCP (Jyrki Yli-Nokari) Organization: Intrinsic Oy, Tampere, FINLAND Lines: 35 In article <140@tdi2.UUCP> brandon@tdi2.UUCP (Brandon Allbery) writes: >IFS=': >' # newline and colon >while read name pass uid gid comment home shell; do > # do something with them >done < /etc/passwd > >This is the ONLY way I've seen it used; frankly, I use "awk" if I want to >process a file in this way anyway, so I see no real use for IFS. Nope! IFS comes in handy if you want to parse command output or, say, PATH ---------- : 'this is a functional equivalent to SV sh type command' IFS=":$IFS" for CMD do for DIR in $PATH do if test -x $DIR/$CMD then echo $DIR/$CMD fi done done ----------- IFS=":$IFS" set `date` echo It\'s $4.$5 -- Jyrki Yli-Nokari, Intrinsic Oy, SF-33100 Tampere, FINLAND USENET: INTERNET: BITNET: FUNET: TELEPHONE: intrin!jty jty@tut.FI YLI at FINTUTA TTKKLK::YLI +358 31 132800