Re: BASH + Best method of converting fields to variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Sa, den 17.07.2004 schrieb Ow Mun Heng um 22:03:

> > How about using the IFS variable for this ?
> > set IFS to ':' and run a for...done loop over each line of the input file.
> 
> I'm not sure how that can be used. 
> 
> One other thing which I found is that by using awk, I'm actually
> processing the file all at once. (as the awk code above shows). I'm not
> sure how I can get BASH to actually process it line-per-line like tcsh's
> foreach.
> 
> Maybe I can learn up on using awk's $NR variable, to get it to
> auto-increment so that I read it line-by-line and process it that way.
> 
> Right now, my random password generator function is making the _same_
> default password for _all_ users. That's Not too great.

cat /etc/passwd | while read line; do
      whatever ...
done

Sorry, I don't really understand what you want to do with the content of
the password file. Maybe you can explain your target a bit more.

Alexander


-- 
Alexander Dalloz | Enger, Germany | GPG key 1024D/ED695653 1999-07-13
Fedora GNU/Linux Core 2 (Tettnang) Athlon CPU kernel 2.6.6-1.435.2.3.uml
Serendipity 22:50:43 up 4 days, 20:33, load average: 0.20, 0.37, 0.37 

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux