Path: utzoo!utgpu!watserv1!watmath!att!pacbell.com!ucsd!celit!billd From: billd@fps.com (Bill Davidson) Newsgroups: comp.bugs.4bsd Subject: Re: Bug in users command Message-ID: <14902@celit.fps.com> Date: 19 Jan 91 01:36:58 GMT References: <18947@rpp386.cactus.org> <1126:Jan1811:17:4091@kramden.acf.nyu.edu> <11104@jpl-devvax.JPL.NASA.GOV> Organization: FPS Computing Inc., San Diego CA Lines: 24 In article <11104@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: >And here's one in Perl. (I recognize that hardcoding the template >for the utmp structure is a weakness. On the other hand, it's short >and to the point. I refer you to the definition of "Minimalism" in >the Perl book.) The perl version is probably faster but if for some reason you don't have perl and you don't mind it being slightly slower: % cat > users.sh #!/bin/sh USERS=`who|sort|awk '{print $1}'` echo $USERS ^D % chmod +x users.sh % users.sh bambam barney betty dino dino fred pebbles wilma I'd say that's pretty minimal. Of course it assumes that your shell can handle back quotes reasonably and that the user name is the first field in the output of "who" but nobody's perfect. If you want to cut out reports of repeat logins, just add a "-u" parameter to the "sort". --Bill Davidson