Advertisement
solidsnake

FINAL Max Password Attempts Activity

Jan 12th, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.87 KB | None | 0 0
  1. echo -n "Enter password: "
  2. read password
  3. entryCounter=0
  4.  
  5. while ([ "$password" != "lestat" ]) && ([ $entryCounter -lt 4 ])
  6. do
  7.     echo
  8.     echo "---INCORRECT password---"
  9.     echo
  10.     echo "$((4-$entryCounter)) attempt(s) remaining"
  11.     echo
  12.     echo -n "Enter NEW password: "
  13.         read password
  14.         entryCounter=$(($entryCounter+1)) #no spaces entryCounter = $((... is wrong
  15. done
  16.  
  17. if [ $entryCounter -eq 4 ]
  18. then
  19. echo "Reached max amount of entry attempts. Exiting..."
  20. else
  21.  
  22.             echo -n "Enter ID Number: "
  23.             read IDNum
  24.             echo -n "Enter Last Name: "
  25.             read Last
  26.             echo -n "Enter First Name: "
  27.             read First
  28.             echo -n "Enter Middle Initial: "
  29.             read Middle
  30.             echo -n "Enter Age: "
  31.             read age
  32.             echo
  33.             echo "DO YOU WANT TO..."
  34.             echo "1. Display Student ID, First and Last Names only"
  35.             echo "2. Display all captured information"
  36.             echo "3. Display terminal-related information only"
  37.             echo "4. Display lucky number for today"
  38.             echo "5. Enter new set of user information"
  39.             echo "6. Exit"
  40.             echo -n "Please enter the number of your choice: "
  41.             read choice
  42.              
  43.             while [ $choice -ne 6 ]
  44.             do
  45.                     case $choice in
  46.                     1)
  47.                             echo "Student ID: $IDNum"
  48.                             echo "First Name: $First"
  49.                             echo "Last Name: $Last"
  50.                             echo
  51.                             echo "DO YOU WANT TO..."
  52.                             echo "1. Display Student ID, First and Last Names only"
  53.                             echo "2. Display all captured information"
  54.                             echo "3. Display terminal-related information only"
  55.                             echo "4. Display lucky number for today"
  56.                             echo "5. Enter new set of user information"
  57.                             echo "6. Exit"
  58.                             echo -n "Please enter the number of your choice: "
  59.                             read choice;;
  60.                     2)
  61.                             echo "Student ID: $IDNum"
  62.                             echo "First Name: $First"
  63.                             echo "Middle Initial: $Middle"
  64.                             echo "Last Name: $Last"
  65.                             echo "Age: $age"
  66.                             echo
  67.                             echo "DO YOU WANT TO..."
  68.                             echo "1. Display Student ID, First and Last Names only"
  69.                             echo "2. Display all captured information"
  70.                             echo "3. Display terminal-related information only"
  71.                             echo "4. Display lucky number for today"
  72.                             echo "5. Enter new set of user information"
  73.                             echo "6. Exit"
  74.                             echo -n "Please enter the number of your choice: "
  75.                             read choice;;
  76.                     3)
  77.                             echo "You are currently logged in as $USER and you current directory is `pwd`"
  78.                             echo
  79.                             echo "DO YOU WANT TO..."
  80.                             echo "1. Display Student ID, First and Last Names only"
  81.                             echo "2. Display all captured information"
  82.                             echo "3. Display terminal-related information only"
  83.                             echo "4. Display lucky number for today"
  84.                             echo "5. Enter new set of user information"
  85.                             echo "6. Exit"
  86.                             echo -n "Please enter the number of your choice: "
  87.                             read choice;;
  88.                     4)
  89.                             echo "Your lucky number for today `date` is $RANDOM"
  90.                             echo
  91.                             echo "DO YOU WANT TO..."
  92.                             echo "1. Display Student ID, First and Last Names only"
  93.                             echo "2. Display all captured information"
  94.                             echo "3. Display terminal-related information only"
  95.                             echo "4. Display lucky number for today"
  96.                             echo "5. Enter new set of user information"
  97.                             echo "6. Exit"
  98.                             echo -n "Please enter the number of your choice: "
  99.                             read choice;;
  100.                     5)
  101.                             echo -n "Enter ID Number: "
  102.                             read IDNum
  103.                             echo -n "Enter Last Name: "
  104.                             read Last
  105.                             echo -n "Enter First Name: "
  106.                             read First
  107.                             echo -n "Enter Middle Initial: "
  108.                             read Middle
  109.                             echo -n "Enter your age: "
  110.                             read age
  111.                             echo
  112.                             echo "DO YOU WANT TO..."
  113.                             echo "1. Display Student ID, First and Last Names only"
  114.                             echo "2. Display all captured information"
  115.                             echo "3. Display terminal-related information only"
  116.                             echo "4. Display lucky number for today"
  117.                             echo "5. Enter new set of user information"
  118.                             echo "6. Exit"
  119.                             echo -n "Please enter the number of your choice: "
  120.                             read choice;;
  121.                     6) ;;
  122.                     *)
  123.                             echo -n "Please enter the number of your choice: "
  124.                             read choice;;
  125.                     esac
  126.             done
  127. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement