daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Jul 15th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/csh
  2. #
  3. # ONOMA: GIANNAKOPOULOU XRISTINA-MARIA
  4. # AM: 3100031
  5.  
  6. echo "1. Εισαγωγή νέου συνδρομητή"
  7. echo "2. Εμφάνιση στοιχείων συνδρομητών"
  8. echo "3. Εμφάνιση όλων των συνδρομητών"
  9. echo "4. Διαγραφή συνδρομητών"
  10. echo "5. Διαγραφή όλων των συνδρομητών"
  11. echo "6. Έξοδος από την εφαρμογή"
  12.  
  13. echo -n "Chose a number:"
  14. set choice = $<
  15. while ($choice == 1)
  16.         echo "     EISAGWGH SYNDROMHTH"
  17.         echo "---------------------------------"
  18.         echo -n "EPWNYMO    : "
  19.         set EPWNYMO = $<
  20.         echo -n "ONOMA      : "
  21.         set ONOMA = $<
  22.         echo -n "THLEFWNO   : "
  23.         set THLEFWNO = $<
  24.         echo "$EPWNYMO $ONOMA $THLEFWNO" >> phones
  25.         echo "---------------------------------"
  26.         echo "Prosthiki neou syndromiti ? (y/n) :"
  27.         set ans = $<
  28.         switch ($ans)
  29.             case n:
  30.                 exit
  31.                 breaksw
  32.             case y:
  33.                 continue
  34.                 breaksw
  35.             default:
  36.                 echo "Lathos epilogh"
  37.                 exit
  38.                 breaksw
  39.         endsw
  40. end
  41.  
  42. while ($choice == 2)
  43.     echo "     EMFANISH SYNDROMITWN"
  44.     echo "--------------------------------"
  45.     echo -n "Search for: "
  46.     set name = $<
  47.     echo "--------------------------------"
  48.     foreach epwnumo (`cat phones | cut -d' ' -f1`)
  49.        
  50.        
  51.             if (`echo $epwnumo | grep -c "^$name"` == 1) then
  52.                 echo $EPWNYMO
  53.                 echo $ONOMA
  54.                 echo $THLEFWNO
  55.             else ($status != 0) then
  56.                 echo "$name: not found!"
  57.             endif
  58.         echo "... press enter"
  59.     end
  60. end
  61.  
  62. while ($choice == 3)
  63.     echo "  EMFANISH OLWN TWN SYNDROMHTWN"
  64.     echo "--------------------------------"
  65.     foreach ($EPWNYMO $ONOMA $THLEFWNO)
  66.         echo $EPWNYMO
  67.         echo $ONOMA
  68.         echo $THLEFWNO
  69.         echo "------------------------"
  70.     end
  71.     echo "Telos arxeiou ..."
  72. end
  73.  
  74. while ($choice == 4)
  75.     echo "    DIAGRAFH SYNDROMITWN"
  76.     echo "--------------------------------"
  77.     echo -n "Search for: "
  78.     set name = $<
  79.     echo "--------------------------------"
  80.     foreach name ($argv)
  81.         grep $name phones
  82.         if(-f $name) then
  83.             echo -n "Na diagrafei? (y/n): "
  84.     set ans = $<
  85.         switch ($ans)
  86.             case n:
  87.                 echo "H diagrafi den egine!"
  88.                 exit
  89.                 breaksw
  90.             case y:
  91.                 echo "H diagrafi egine!"
  92.                 continue
  93.                 breaksw
  94.             default:
  95.                 echo "Lathos epilogh"
  96.                 exit
  97.                 breaksw
  98.         endsw
  99.     end
  100. end
  101.  
  102. while ($choice == 5)
  103.    
  104.     if ! (-e phones)
  105.         echo "To arxeio den uparxei!"
  106.         exit(1)
  107.     else if ($#argv == 0)
  108.         echo "To arxeio einai adeio!"
  109.     else
  110.         echo "Diagrafi olwn? (y/n)"
  111.     endif
  112.     set an = $<
  113.     switch ($an)
  114.         case n:
  115.             exit
  116.         case y:
  117.             rm -r *
  118.             echo "H diagrafi egine!"
  119.             continue
  120.     endsw
  121. end
  122.  
  123. while ($choice == 6)
  124.     exit
  125. end
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