Apr 22 2009
Computer Homework
Well I just finished my computer homework. It gave me a bit of trouble, mainly cause I no longer pay attention in class and just go on Facebook the entire time. Hopefully next time I’m in a computer class I pay more attention. After all, it is my major. Anyways heres the code I wrote. It’s a c-shell application for unix where it monitors how many users are logged on ever minute for 15 minutes. It displays the number and at the end it displays the fewest number of users on the server.
#!/bin/csh
#Homework 5
@ n = 1
@ m = 0
@ x = 1000
while ( $n <= 15 )
@ m = ` ( who | wc -l ) `
echo “Case $n : There are currently $m users online.”
sleep 3
if ( $m < $x ) then
@ x = $m
else
endif
@ n++
end
echo "The smallest number of users online was $x"
Possibly-related Articles:                                        (auto-generated)