Contanews


[Home] [Dissertação] [Biba] [Linux] [Conjugue] [br.ispell] [axw3] [uplink]

#!/bin/ksh
#
# contanews: conta quantos usuarios tem o .newsrc atualizado
# uso: contanews data, onde data esta' no formato do touch (system V)
#
#

typeset -i contatem;
typeset -i contanaotem;
typeset -i contanaosei;

typeset -i tottem=0;
typeset -i totnaotem=0;
typeset -i totnaosei=0;

arqdata=/tmp/contanews.$USER
/usr/5bin/touch $1 $arqdata

echo " grupo    tem     ~tem    ?"
echo "-----------------------------"

for d in mac mae map mat posmac posmae posmap posmat gradmac gradmat specmac specmae specmap specmat;
  do 
    contatem=0;
    contanaotem=0;
    contanaosei=0;
    for u in /home/$d/*
      do
        if [ ! -r $u ]
          then
            let contanaosei="contanaosei + 1";
        elif [ $u/.newsrc -nt $arqdata ]
          then
            let contatem="contatem + 1";
        else
            let contanaotem="contanaotem + 1";
        fi
      done
      echo "$d  $contatem       $contanaotem    $contanaosei"
      let tottem="tottem + contatem";
      let totnaotem="totnaotem + contanaotem";
      let totnaosei="totnaosei + contanaosei";
  done
echo "-----------------------------"
echo "total     $tottem $totnaotem      $totnaosei"

rm $arqdata