SHARE
TWEET

Untitled

a guest Dec 2nd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/sh
  2.  
  3. if [ $# -ls 2 ]
  4. then
  5.     echo "Usage: $0 <file> n1 n2 ..."
  6.     exit 1
  7. fi
  8.  
  9.  
  10. if ! [ -f $1 ]
  11. then
  12.     echo "$1 is not a regular file"
  13.     exit 1
  14. fi
  15.  
  16.  
  17. while read line
  18. do
  19.     rez=`echo $linie | grep '[0-9]+'`
  20.     if ! [ -z "$rez" ]
  21.     then
  22.         nr=$rez
  23.         break
  24.     else
  25.         echo "Number not found"
  26.         exit 1
  27.     fi
  28. done < $1
  29.  
  30. for i in ${@:2}
  31. do
  32.     if [ $(($i % $nr)) -eq 0 ]
  33.     then
  34.     c=$c + ${#i}
  35.     echo "Primul nr are $c cifre.  "
  36.     fi
  37. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top