Re: [ILUG] grep or awk

From: Aidan Kehoe (kehoea at domain parhasard.net)
Date: Mon 10 Sep 2001 - 17:22:09 IST


 Ar an 10u la de mi 9, scriobh Chris Higgins :

> We're talking about the contents of the wtmp/utmp files, as interpreted by
> the command 'who'
>
> If you upgrade your version of who, and the formatting changes slightly,
> you run the risk of breaking your scripts (in strange and wonderful ways).

Anyone going to change who to do that is going to have to be both
brave & a fan of needless incompatibility. Oh, wait, this is linux.

5:11PM ~ > uname
OpenBSD
5:13PM ~ > who -m
kehoea ttyp0 Sep 10 16:39 (my.host.name)
5:13PM ~ >

5:14PM ~ > uname
OSF1
5:14PM ~ > who -m
kehoea pts/8 Sep 10 16:39 (my.host.name)
5:14PM ~ >

$ uname
SunOS
$ who -m
kehoea pts/1 Sep 10 17:16 (my.host.name)
$

$ uname
Linux
$ who -m
pc734!kehoea pts/6 Sep 10 17:14 (my.host.name)
$

> Would it not make more sense to query the files directly so that
> you can be sure that the information is more reliable than grep'ing
> from 'who'

getutent(3) and setutent(3) are less portable than who(1), believe it
or not.

-- 
`... when the elephant man broke strong men's necks, when he'd had too 
many Powers, ...'


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:12:03 GMT