[PLUG] shell scripting problem

Matt Alexander m at netpro.to
Fri Jun 7 06:16:56 UTC 2002


On Thu, 6 Jun 2002, Matt Alexander wrote:

> On Thu, 6 Jun 2002, Jeme A Brelin wrote:
>
> >
> > On Thu, 6 Jun 2002, Matt Alexander wrote:
> > > This works for me:
> > > for name in `cat namelist`;do sed /$name/d group > newgroup;done
> >
> > I can't imagine how it does.
> >
> > I mean, you're removing one name from the original group file each time
> > and writing out a new newgroup file for each name you remove.
>
> I agree, it doesn't make sense, but it does work.  Anyone care to explain
> why?

Uhh...  OK, it doesn't work.  Well, it sort of works.  What the heck is
going on?

Here's a test run I just did:

Here's a test namelist:

root
bin
daemon
halt
mail
operator
vcsa
rpm
xfs
m


Here's the group file:

root:x:0:root
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin,adm
adm:x:4:root,adm,daemon
tty:x:5:
disk:x:6:root
lp:x:7:daemon,lp
mem:x:8:
kmem:x:9:
wheel:x:10:root
mail:x:12:mail
man:x:15:
dip:x:40:
lock:x:54:
nobody:x:99:
users:x:100:
slocate:x:21:
floppy:x:19:
vcsa:x:69:
utmp:x:22:
rpm:x:37:
xfs:x:43:
m:x:500:


Here's the newgroup file:

root:x:0:root
tty:x:5:
disk:x:6:root
wheel:x:10:root
dip:x:40:
lock:x:54:
nobody:x:99:
users:x:100:
slocate:x:21:
floppy:x:19:
vcsa:x:69:
xfs:x:43:





More information about the PLUG mailing list