His "who" implementation is 73 lines (21 if you remove blank lines and comments). Compare that to 836 in GNU Coreutils[0]. [0] https://github.com/coreutils/coreutils/blob/master/src/who.c
plan 9 who is a 3 line shell script that just greps the output of ps and sorts it. You could eliminate ps and just grep through /proc but why reinvent the wheel when an existing tool already does part of the job? I see some comments here citing a lack of options, most of which appear to have nothing to do with who is logged into the machine.
The Unix `Who` Command
21–30 of 43 posts
Re: The Unix `Who` Command
#22Re: The Unix `Who` Command
#23Earlier quoted context omitted.
plan 9 who is a 3 line shell script that just greps the output of ps and sorts it. You could eliminate ps and just grep through /proc but why reinvent the wheel when an existing tool already does part of the job? I see some comments here citing a lack of options, most of which appear to have nothing to do with who is logged into the machine.
Source for the mentioned script: https://github.com/0intro/plan9/blob/master/rc/bin/who . Also, other utilities implemented as scripts are fshalt (P9's shutdown), kill, lookman (P9's apropos), uptime and whois.
Re: The Unix `Who` Command
#24Earlier quoted context omitted.
Source for the mentioned script: https://github.com/0intro/plan9/blob/master/rc/bin/who . Also, other utilities implemented as scripts are fshalt (P9's shutdown), kill, lookman (P9's apropos), uptime and whois.
Does anybody know why there are line breaks in the sed command?
Re: The Unix `Who` Command
#25who is 66 % waste: w is 300 % shorter and shows up to 721 % more valuable information.
(OK w -f shows this)
Re: The Unix `Who` Command
#26His "who" implementation is 73 lines (21 if you remove blank lines and comments). Compare that to 836 in GNU Coreutils[0]. [0] https://github.com/coreutils/coreutils/blob/master/src/who.c
Re: The Unix `Who` Command
#27And there is no point in setting the locale, since your program never uses it.
Re: The Unix `Who` Command
#28You'll find, in archives from hacking sites of the era, a whole variety of "utmp editors".
Re: The Unix `Who` Command
#29Re: The Unix `Who` Command
#30I’ve found grep to be unreliable or behave unexpectedly with strace. Even when piping to strings first, although not sure if that is of any consequence. Anyone know why that is or experienced the same?