Three Input Monty

From InterGen, 7 Years ago, written in Bash, viewed 602 times.
URL https://paste.intergen.online/view/b6aadc78 Embed
Download Paste or View Raw
  1. #!/bin/bash
  2.  
  3. clear
  4.  
  5. echo -e "\n\n"
  6. echo -n "  Enter string 1: "
  7. read -r string_1
  8.  
  9. echo -e "\n"
  10. echo -n "  Enter string 2: "
  11. read -r string_2
  12.  
  13. echo -e "\n"
  14. echo -n "  Enter string 3: "
  15. read -r string_3
  16.  
  17. if [ "$string_1" == "$string_2" ] && [ "$string_2" == "$string_3" ]; then
  18.     echo -e "\n\n  All strings match:\n"
  19.     echo -e "  String 1: ${string_1}\n"
  20.     echo -e "  String 2: ${string_2}\n"
  21.     echo -e "  String 3: ${string_3}\n\n"
  22. elif [ "$string_1" != "$string_2" ] && [ "$string_1" == "$string_3" ]; then
  23.     echo -e "\n\n  Two strings match:\n"
  24.     echo -e "  String 1: ${string_1}\n"
  25.     echo -e "  String 3: ${string_3}\n\n"
  26. elif [ "$string_1" == "$string_2" ] && [ "$string_1" != "$string_3" ]; then
  27.     echo -e "\n\n  Two strings match:\n"
  28.     echo -e "  String 1: ${string_1}\n"
  29.     echo -e "  String 2: ${string_2}\n\n"
  30. else
  31.     echo -e "\n\n  No strings match!\n\n"
  32. fi

Reply to "Three Input Monty"

Here you can reply to the paste above