Advertisement
ostyleo

Untitled

Apr 10th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ $# -ne 0 ];then
  4.     echo Scriptul nu accepta parametri!
  5.     exit2
  6. fi
  7.  
  8. numere=0
  9. siruri=0
  10. directoare=0
  11. fisiere=0
  12. while read par;do
  13.     if [ $par = "STOP" ];then
  14.         break
  15.     else
  16.         if [ -d $par ];then
  17.             directoare=`expr $directoare + 1`
  18.         else
  19.             if [ -f $par ];then
  20.                 fisiere=`expr $fisiere + 1`
  21.             else
  22.                 if `echo $par|grep -q ^[0-9]*.[0-9]*$` && `echo $par|grep -q ^[^.]` && `echo $par|grep -q [^.]$`;then
  23.                     numere=`expr $numere + 1`
  24.                 else
  25.                     siruri=`expr $siruri + 1`
  26.                 fi
  27.             fi
  28.         fi
  29.     fi
  30. done
  31. clear
  32.  
  33. echo
  34. echo ----------------------------
  35. echo Sunt $numere numere!
  36. echo Sunt $siruri siruri!
  37. echo Sunt $directoare directoare!
  38. echo Sunt $fisiere fisiere!
  39. echo ----------------------------
  40. echo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement