[Webfunds-devel] Re: [Webfunds-commits] scripts ricardian_keys

Ian Grigg iang@systemics.com
Wed, 23 Aug 2000 13:34:22 -0400


Edwin Woudt wrote:
> 
> --On woensdag 23 augustus 2000 12:47 -0400 Ian Grigg <iang@cypherpunks.ai>
> wrote:
> 
> > id=$(sed -e /${pw}/'!d' -e s/.*${pw}// -e s/:.*// < /etc/passwd)
> 
> Why does a script like this need to access /etc/passwd ?

This reads the password file in order to extract out the
full name of the user.  There may be a nicer way, but I
cannot recall if there is.

In short, the sed reads the password file, deletes all
lines that don't match the uid/gid combination, and then
extracts the field after that.  It could be done more
accurately, for example with awk(1) but I don't use that
myself.

> PS: I wasn't able to figure out the inner workings of this script due to my
> limited perl parsing abilities. Or at least, I guessed it was perl
> (shouldn't there be a #/usr/bin/perl at the top then or something?)

Nah, it's all shell.  It is in fact bash, so, yes, might want
a #!/usr/bin/bash at the top, but as I'm running bash and it
is the default shell, I forgot that bit.

-- 
iang