Advertisement
Joshua-Hoffman

Trix

Jan 23rd, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.60 KB | None | 0 0
  1. #!/bin/bash
  2. #    ____________________________________________________________________________________________________
  3. #   |* ___________________________________________GPL-3_Licence________________________________________ *|
  4. #   | /                                                                                                \ |
  5. #   | |         This program is free software: you can redistribute it and/or modify                   | |
  6. #   | |         it under the terms of the GNU General Public License as published by                   | |
  7. #   | |         the Free Software Foundation, either version 3 of the License, or                      | |
  8. #   | |         (at your option) any later version.                                                    | |
  9. #   | |                                                                                                | |
  10. #   | |         This program is distributed in the hope that it will be useful,                        | |
  11. #   | |         but WITHOUT ANY WARRANTY; without even the implied warranty of                         | |
  12. #   | |         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                          | |
  13. #   | |         GNU General Public License for more details.                                           | |
  14. #   | |                                                                                                | |
  15. #   | |         You should have received a copy of the GNU General Public License                      | |
  16. #   | |         along with this program.  If not, see <http://www.gnu.org/licenses/>.                  | |
  17. #   | |                                                                                                | |
  18. #   | \________________________________________________________________________________________________/ |
  19. #https://pastebin.com/gdUYBtQb
  20.  
  21. B=$1
  22.  
  23. Trix () {
  24.  
  25. N=$@
  26. unset
  27.  
  28. A=( 0 0 0 {1..10} 25 50 100 1024 {a..z} exit )
  29.  
  30.     if [[ 1 = 1 ]]; then
  31.     C=( $(awk -F'\}' '/\(\)/ && !/awk/ && !/Trix/ {print $0"\n"}' $0 | tr -d [:blank:],\(,\),\{) )
  32.     else
  33.     C=( D )
  34.     fi
  35.    
  36.     for E in ${C[@]}; do
  37.     declare -A Fd
  38.     ((G++))
  39.    
  40.         for H in ${A[@]}; do
  41.         ((M++))
  42.        
  43.             if [[ $H = 0 && $M -le 3 ]]; then
  44.             eval F[-B$M]+="$E"_B_$M=\${"$E"_B_$M:-$H\ }
  45.             elif [[ $H =~ ^[1-9] ]]; then
  46.             eval F[-N$H]+="$E"_N_$H=\${"$E"_N_$H:-$H\ }
  47.             else
  48.             eval F[-L$H]+="$E"_L_$H=\${"$E"_L_$H:-$H\ }
  49.             fi
  50.            
  51.         done
  52.        
  53.         for I in ${N[@]}; do
  54.         ((J++))
  55.        
  56.             if [[ -n ${F[$I]} ]]; then
  57.             K=$I
  58.             elif (( $J % 2 )); then
  59.             unset && exit 1
  60.             else
  61.             L=$(echo ${F[$K]})
  62.             eval export ${L/=*/=$I}
  63.             unset F[$K]
  64.             fi
  65.    
  66.         done
  67.        
  68.     unset M
  69.     done
  70. }
  71.  
  72. Decision () {
  73.  
  74.     until [[ $Say_It =~ ^(y|n) ]]; do
  75.     read -p "$1 (y/n)?: " Say_It && Say_It=${Say_It,,}
  76.  
  77.         if [[ ! ${Say_It::1} =~ ^(y) ]] || [[ ! ${Decision_B_1:=0} = 0 ]]; then
  78.         read -p "You selected $Say_It (y/n)?: " Say_What && Say_What=${Say_What,,}
  79.  
  80.             if [[ ! ${Say_What::1} =~ ^(y) ]] || [[ ! ${Say_It::1} =~ ^(y|n) ]]; then
  81.             read -p "You seem unsure.."
  82.             unset Say_It && unset Say_What
  83.             elif [[ ${Say_It::1} =~ ^(n) && ${Say_What::1} =~ ^(y)  ]]; then
  84.             Decision_N_1=0
  85.             fi
  86.  
  87.         fi
  88.  
  89.     done
  90.    
  91. return ${Decision_N_1:=1}
  92.  
  93. }
  94.  
  95. Questionable () {
  96.  
  97.     while [[ -z "$Sound" ]]; do
  98.     read -ep "Enter "$1"?: " Sound
  99.  
  100.         if [[ ${Questionable_B_1:=0} != 0 ]]; then
  101.         Decision "I got: \"$Sound\" - Correct"; Sound_Check="$?"
  102.  
  103.             if [[ "$Sound_Check" != 1 ]]; then
  104.             unset Sound
  105.             fi
  106.  
  107.         fi
  108.  
  109.     done
  110.  
  111.     if [[ ${Questionable_B_2:=0} != 0 ]]; then
  112.     echo "You entered: \"$Sound\""
  113.     fi
  114.  
  115. export "$Sound"
  116.  
  117. }
  118.  
  119. Trix -B1 0 -B2 0
  120. Questionable $1
  121. echo $Sound
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement