Advertisement
Godleydemon

generate.sh

Aug 26th, 2014
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 10.59 KB | None | 0 0
  1. #!/bin/bash
  2. ##Functions##
  3. saveFunction(){
  4. echo "#!/bin/bash" >> ./human/$NAME.txt
  5. echo "NAME='$NAME'" >> ./human/$NAME.txt
  6. echo "AGE='$AGE'" >> ./human/$NAME.txt
  7. echo "GENDER='$GENDER'" >> ./human/$NAME.txt
  8. echo "GLASSES='$GLASSES'" >> ./human/$NAME.txt
  9. echo "WEIGHT='$WEIGHT'" >> ./human/$NAME.txt
  10. echo "LENGTH='$LENGTH'" >> ./human/$NAME.txt
  11. echo "HAIR='$HAIR'" >> ./human/$NAME.txt
  12. echo "FEET='$FEET'" >> ./human/$NAME.txt
  13. echo "INCHES='$INCHES'" >> ./human/$NAME.txt
  14. echo "STR='$STR'" >> ./human/$NAME.txt
  15. echo "DEX='$DEX'" >> ./human/$NAME.txt
  16. echo "CON='$CON'" >> ./human/$NAME.txt
  17. echo "INT='$INT'" >> ./human/$NAME.txt
  18. echo "WIS='$WIS'" >> ./human/$NAME.txt
  19. echo "CHAR='$CHAR'" >> ./human/$NAME.txt
  20. echo "JOB='$JOB'" >> ./human/$NAME.txt
  21. if [ "$GENDER" == "female" ]; then
  22.     echo "BREAST='$BREAST'" >> ./human/$NAME.txt
  23.     echo "File saved at ./human/$NAME.txt"
  24. fi
  25. }
  26.  
  27. statsFunction(){
  28. echo "Name: " $NAME
  29. echo "Age:" $AGE
  30. echo "Gender: " $GENDER
  31. echo "$GLASSES"
  32. echo "Weight: " $WEIGHT
  33. echo "Hair: " $LENGTH " and " $HAIR
  34. echo "Height: "$FEET "Feet" $INCHES "Inches"
  35. echo "Job: " $JOB
  36. echo "STR: " $STR
  37. echo "DEX: " $DEX
  38. echo "CON: " $CON
  39. echo "INT: " $INT
  40. echo "WIS: " $WIS
  41. echo "CHAR: " $CHAR
  42.  
  43. if [ "$GENDER" == "female" ]; then
  44.     case $BREAST in
  45.     1) BREAST="A" ;;
  46.     2) BREAST="B" ;;
  47.     3) BREAST="C" ;;
  48.     4) BREAST="D" ;;
  49.     5) BREAST="DD" ;;
  50.     6) BREAST="E" ;;
  51.     esac
  52.     echo "Breasts Size: " $BREAST
  53. fi
  54. }
  55.  
  56. ##Beginning of running script##
  57. read -p "would you like to load a file? y/n: " LOAD
  58.  
  59. ##Load if statement, should detect wether there is a human folder or not first##
  60. if [ "$LOAD" == "y" ]; then
  61.     if [ -d ./human ]; then
  62.         echo "--Files currently available--"
  63.         ls ./human
  64.         read -p "please type the exact name of the character without .txt: " CHARACTER
  65.         . ./human/$CHARACTER.txt
  66.     else
  67.         echo "There are currently no files to load or the human directory was moved!"
  68.         exit
  69.     fi
  70. else
  71.  
  72. ##Beginning of character creation##
  73.     read -p "Please enter a name: " NAME
  74.     read -p "Please enter gender male/female: " GENDER
  75.     AGE=`shuf -i 17-40 -n 1`
  76.     WEIGHT=`shuf -i 90-180 -n 1`
  77.     HAIR=`shuf -i 1-6 -n 1`
  78.     LENGTH=`shuf -i 1-4 -n 1`
  79.     EYES=`shuf -i 1-4 -n 1`
  80.     FEET=`shuf -i 4-6 -n 1`
  81.     INCHES=`shuf -i 0-11 -n 1`
  82.     BREAST=`shuf -i 1-6 -n 1`
  83.     GLASSES=`shuf -i 0-1 -n 1`
  84.     STR=`shuf -i 3-18 -n 1`
  85.     DEX=`shuf -i 3-18 -n 1`
  86.     CON=`shuf -i 3-18 -n 1`
  87.     INT=`shuf -i 3-18 -n 1`
  88.     WIS=`shuf -i 3-18 -n 1`
  89.     CHAR=`shuf -i 3-18 -n 1`
  90.     JOBROLL=`shuf -i 1-6 -n 1`
  91.  
  92. fi
  93.  
  94. ##The various astetic attributes based on random rolls##
  95. case $JOBROLL in
  96.     1) JOB="CEO" ;;
  97.     2) JOB="Vice-President" ;;
  98.     3) JOB="HumanResources" ;;
  99.     4) JOB="ITManager" ;;
  100.     5) JOB="TechSupport" ;;
  101.     6) JOB="SalesFloorEmployee" ;;
  102. esac
  103.  
  104. case $HAIR in
  105.     1) HAIR="White" ;;
  106.     2) HAIR="Black" ;;
  107.     3) HAIR="Red" ;;
  108.     4) HAIR="Blonde" ;;
  109.     5) HAIR="Brunette" ;;
  110.     6) HAIR="Grey" ;;
  111. esac
  112.  
  113. case $LENGTH in
  114.     1) LENGTH="Short" ;;
  115.     2) LENGTH="Medium" ;;
  116.     3) LENGTH="Long" ;;
  117.     4) LENGTH="Super Long" ;;
  118. esac
  119.  
  120. case $EYES in
  121.     1) EYES="Brown" ;;
  122.     2) EYES="Blue" ;;
  123.     3) EYES="Green" ;;
  124.     4) EYES="Hazel" ;;
  125. esac
  126.  
  127. case $GLASSES in
  128.     0) GLASSES="Eyes: $EYES and wears glasses" ;;
  129.     1) GLASSES="Eye color: $EYES" ;;
  130. esac
  131.  
  132. ##This is where it calls the stats and echos them back##
  133. statsFunction
  134.  
  135. echo " "
  136.  
  137. ##Flavor text, will add more to this later##
  138. if [ "$GENDER" == "female" ]; then
  139.     if [ "$JOB" == "CEO" ]; then
  140.         if [ "$INT" == "3" ]; then
  141.             echo "You stare blankly at the square box in front of you and scratch at your $HAIR hair. You know this box is supposed to do something. You smack it thinking it might help. Unfortunately it seems smacking it caused a piece to fall off. Picking it up you examine it and pull out a hammer. Knowing full well this will fix the problem."
  142.         elif [ "$INT" -le "14" ]; then
  143.             echo "Being a woman, it's been hard to be in the lime light of the company, being that you're not particularly smart. Especially in the IT field. You think secretly the IT scum are making fun of you behind your back. You always just merely flip your $LENGTH $HAIR hair and turn your nose up at them as they walk by. Knowing full well they like the view as you walk away."
  144.         elif [ "$INT" -le "17" ]; then
  145.             echo "Being that you're a woman and the owner of your own company. Not many think that you're smart, but the IT guys seem to have your back when it comes to questions. They're nice and respectful and you always seem to have the right questions and follow through with their advice. You may be no tech guru, but you sure as hell try."
  146.         else
  147.             echo "It's been rough being a woman, and being extremely intelligent. Especially to the IT crowd. Not many women fills it's rosters. You made this company, and grew it from the ground up with barely any need of an IT crew. You hire them anyways though to carry out the tasks you deem necessary and they don't seem to really complain too much. They know you're not stupid and respect your decisions."
  148.         fi
  149.     elif [ "$JOB" == "Vice-President" ]; then
  150.         if [ "$INT" == "3" ]; then
  151.             echo "completely and utter failure $JOB"
  152.         elif [ "$INT" -le "14" ]; then
  153.             echo "Dumb $JOB"
  154.         elif [ "$INT" -le "17" ]; then
  155.             echo "Semi-smart $JOB"
  156.         else
  157.             echo "Smart $JOB"
  158.         fi
  159.     elif [ "$JOB" == "HumanResources" ]; then
  160.         if [ "$INT" == "3" ]; then
  161.             echo "completely and utter failure $JOB"
  162.         elif [ "$INT" -le "14" ]; then
  163.             echo "Dumb $JOB"
  164.         elif [ "$INT" -le "17" ]; then
  165.             echo "Semi-smart $JOB"
  166.         else
  167.             echo "Smart $JOB"
  168.         fi
  169.     elif [ "$JOB" == "ITManager" ]; then
  170.         if [ "$INT" == "3" ]; then
  171.             echo "completely and utter failure $JOB"
  172.         elif [ "$INT" -le "14" ]; then
  173.             echo "Dumb $JOB"
  174.         elif [ "$INT" -le "17" ]; then
  175.             echo "Semi-smart $JOB"
  176.         else
  177.             echo "Smart $JOB"
  178.         fi
  179.     elif [ "$JOB" == "TechSupport" ]; then
  180.         if [ "$INT" == "3" ]; then
  181.             echo "completely and utter failure $JOB"
  182.         elif [ "$INT" -le "14" ]; then
  183.             echo "Dumb $JOB"
  184.         elif [ "$INT" -le "17" ]; then
  185.             echo "Semi-smart $JOB"
  186.         else
  187.             echo "Smart $JOB"
  188.         fi
  189.     elif [ "$JOB" == "SalesFloorEmployee" ]; then
  190.         if [ "$INT" == "3" ]; then
  191.             echo "completely and utter failure $JOB"
  192.         elif [ "$INT" -le "14" ]; then
  193.             echo "Dumb $JOB"
  194.         elif [ "$INT" -le "17" ]; then
  195.             echo "Semi-smart $JOB"
  196.         else
  197.             echo "Smart $JOB"
  198.         fi
  199.     fi
  200. else
  201.  
  202.     if [ "$JOB" == "CEO" ]; then
  203.         if [ "$INT" == "3" ]; then
  204.             echo "You stare blankly at the square box in front of you and scratch at your $HAIR hair. You know this box is supposed to do something. You smack it thinking it might help. Unfortunately it seems smacking it caused a piece to fall off. Picking it up you examine it and pull out a hammer. Knowing full well this will fix the problem."
  205.         elif [ "$INT" -le "14" ]; then
  206.             echo "You are the big cheese, the boss to end all bosses. Those IT guys and their thingamajiggers aren't anything to you. You rule this company with an iron fist and it doesn't matter a lick that you don't even know what a survore is."
  207.         elif [ "$INT" -le "17" ]; then
  208.             echo "Looking at your email you notice you've lost connection to the exchange server. Knowing that's a pretty bad thing you call up the IT department just to double check they're on the case. Knowing full well they're probably already on it. You love your IT guys, they keep the world revolving."
  209.         else
  210.             echo "You've pretty much single handedly programmed every server in the company and often times find yourself in the IT department just to get your hands dirty. The IT guys love you and often come to your own office just to chit chat. You always make sure the IT department is well taken care of and often make sure the rest of your employees go through your general computing classes."
  211.         fi
  212.     elif [ "$JOB" == "Vice-President" ]; then
  213.         if [ "$INT" == "3" ]; then
  214.             echo "completely and utter failure $JOB"
  215.         elif [ "$INT" -le "14" ]; then
  216.             echo "Dumb $JOB"
  217.         elif [ "$INT" -le "17" ]; then
  218.             echo "Semi-smart $JOB"
  219.         else
  220.             echo "Smart $JOB"
  221.         fi
  222.     elif [ "$JOB" == "HumanResources" ]; then
  223.         if [ "$INT" == "3" ]; then
  224.             echo "completely and utter failure $JOB"
  225.         elif [ "$INT" -le "14" ]; then
  226.             echo "Dumb $JOB"
  227.         elif [ "$INT" -le "17" ]; then
  228.             echo "Semi-smart $JOB"
  229.         else
  230.             echo "Smart $JOB"
  231.         fi
  232.     elif [ "$JOB" == "ITManager" ]; then
  233.         if [ "$INT" == "3" ]; then
  234.             echo "completely and utter failure $JOB"
  235.         elif [ "$INT" -le "14" ]; then
  236.             echo "Dumb $JOB"
  237.         elif [ "$INT" -le "17" ]; then
  238.             echo "Semi-smart $JOB"
  239.         else
  240.             echo "Smart $JOB"
  241.         fi
  242.     elif [ "$JOB" == "TechSupport" ]; then
  243.         if [ "$INT" == "3" ]; then
  244.             echo "completely and utter failure $JOB"
  245.         elif [ "$INT" -le "14" ]; then
  246.             echo "Dumb $JOB"
  247.         elif [ "$INT" -le "17" ]; then
  248.             echo "Semi-smart $JOB"
  249.         else
  250.             echo "Smart $JOB"
  251.         fi
  252.     elif [ "$JOB" == "SalesFloorEmployee" ]; then
  253.         if [ "$INT" == "3" ]; then
  254.             echo "completely and utter failure $JOB"
  255.         elif [ "$INT" -le "14" ]; then
  256.             echo "Dumb $JOB"
  257.         elif [ "$INT" -le "17" ]; then
  258.             echo "Semi-smart $JOB"
  259.         else
  260.             echo "Smart $JOB"
  261.         fi
  262.     fi
  263.  
  264. fi
  265.  
  266. ##Beginning of code Save block, should do some checks to see if human is present and such##
  267. read -p "Would you like to save this? n/y: " SAVE
  268.  
  269. FILENAME="./human/$NAME.txt"
  270. if [ -d ./human ]; then
  271.     if [ "$SAVE" == "y" ]; then
  272.         if [ -f "$FILENAME" ]; then
  273.             read -p "This file exists, would you like to overwrite? y/n: " overwrite
  274.             if [ "$overwrite" == "y" ]; then
  275.                 rm ./human/$NAME.txt
  276.                 saveFunction
  277.                 exit
  278.             fi
  279.         else
  280.             saveFunction
  281.         fi
  282.     else
  283.         exit
  284.     fi
  285. else
  286.     mkdir ./human
  287.     saveFunction
  288. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement