1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
if [ $# -ne 1 ]
then
echo Syntaxe incorrecte
else
if [ -d $1 ]
then
ls l $1 > ficTemp1401
cat ficTemp1401 | grep ^-> ficTemp1401
cat ficTemp1401 | awk {print $1 $5} > ficTemp1401
cat ficTemp1401 | cut d f2 | grep [0-9] > ficTemp1401
nbLignes=`cat ficTemp1401 | wc l`
i=1
total=0
while [ $i le $nbLignes ]
do
nb=`cat ficTemp1401 | head -$i | tail -1`
total=`expr $total + $nb`
i=`expr $i + 1`
done
rm rf ficTemp1401
echo Contenu de \$1\ :
echo $total octets dans $nbLignes fichiers
else
echo Erreur, l\argument n\est pas un repertoire
fi
fi 2>/dev/null |