Guest User

generate.sh

a guest
Aug 26th, 2014
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.88 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)
  46.         BREAST="A"
  47.         ;;
  48.     2)
  49.         BREAST="B"
  50.         ;;
  51.     3)
  52.         BREAST="C"
  53.         ;;
  54.     4)
  55.         BREAST="D"
  56.         ;;
  57.     5)
  58.         BREAST="DD"
  59.         ;;
  60.     6)
  61.         BREAST="E"
  62.         ;;
  63.     esac
  64.     echo "Breasts Size: " $BREAST
  65. fi
  66. }
  67.  
  68. ##Beginning of running script##
  69. read -p "would you like to load a file? y/n: " LOAD
  70.  
  71. ##Load if statement, should detect wether there is a human folder or not first##
  72. if [ "$LOAD" == "y" ]; then
  73.     if [ -d ./human ]; then
  74.         echo "--Files currently available--"
  75.         ls ./human
  76.         read -p "please type the exact name of the character without .txt: " CHARACTER
  77.         . ./human/$CHARACTER.txt
  78.     else
  79.         echo "There is currently no files to load or the human directory was moved!"
  80.         exit
  81.     fi
  82. else
  83.  
  84. ##Beginning of character creation##
  85.     read -p "Please enter a name: " NAME
  86.     read -p "Please enter gender male/female: " GENDER
  87.     AGE=`shuf -i 17-40 -n 1`
  88.     WEIGHT=`shuf -i 90-180 -n 1`
  89.     HAIR=`shuf -i 1-6 -n 1`
  90.     LENGTH=`shuf -i 1-4 -n 1`
  91.     EYES=`shuf -i 1-4 -n 1`
  92.     FEET=`shuf -i 4-6 -n 1`
  93.     INCHES=`shuf -i 0-11 -n 1`
  94.     BREAST=`shuf -i 1-6 -n 1`
  95.     GLASSES=`shuf -i 0-1 -n 1`
  96.     STR=`shuf -i 3-18 -n 1`
  97.     DEX=`shuf -i 3-18 -n 1`
  98.     CON=`shuf -i 3-18 -n 1`
  99.     INT=`shuf -i 3-18 -n 1`
  100.     WIS=`shuf -i 3-18 -n 1`
  101.     CHAR=`shuf -i 3-18 -n 1`
  102.     JOBROLL=`shuf -i 1-6 -n 1`
  103.  
  104. fi
  105.  
  106. ##The various astetic attributes based on random rolls##
  107. case $JOBROLL in
  108.     1)
  109.         JOB="CEO"
  110.         ;;
  111.     2)
  112.         JOB="Vice-President"
  113.         ;;
  114.     3)
  115.         JOB="HumanResources"
  116.         ;;
  117.     4)
  118.         JOB="ITManager"
  119.         ;;
  120.     5)
  121.         JOB="TechSupport"
  122.         ;;
  123.     6)
  124.         JOB="SalesFloorEmployee"
  125.         ;;
  126. esac
  127.  
  128. case $HAIR in
  129.     1)
  130.         HAIR="White"
  131.         ;;
  132.     2)
  133.         HAIR="Black"
  134.         ;;
  135.     3)
  136.         HAIR="Red"
  137.         ;;
  138.     4)
  139.         HAIR="Blonde"
  140.         ;;
  141.     5)
  142.         HAIR="Burnette"
  143.         ;;
  144.     6)
  145.         HAIR="Grey"
  146.         ;;
  147. esac
  148.  
  149. case $LENGTH in
  150.     1)
  151.         LENGTH="Short"
  152.         ;;
  153.     2)
  154.         LENGTH="Medium"
  155.         ;;
  156.     3)
  157.         LENGTH="Long"
  158.         ;;
  159.     4)
  160.         LENGTH="Super Long"
  161.         ;;
  162. esac
  163.  
  164. case $EYES in
  165.     1)
  166.         EYES="Brown"
  167.         ;;
  168.     2)
  169.         EYES="Blue"
  170.         ;;
  171.     3)
  172.         EYES="Green"
  173.         ;;
  174.     4)
  175.         EYES="Hazel"
  176.         ;;
  177. esac
  178.  
  179. case $GLASSES in
  180.     0)
  181.         GLASSES="Eyes: $EYES and wears glasses"
  182.         ;;
  183.     1)
  184.         GLASSES="Eye color: $EYES"
  185.         ;;
  186. esac
  187.  
  188. ##This is where it calls the stats and echos them back##
  189. statsFunction
  190.  
  191. echo " "
  192.  
  193. ##Flavor text, will add more to this later##
  194. if [ "$GENDER" == "female" ]; then
  195.     if [ "$JOB" == "CEO" ]; then
  196.         if [ "$INT" == "3" ]; then
  197.             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. Unfortunantly 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."
  198.         elif [ "$INT" -le "14" ]; then
  199.             echo "Being a woman, it's been hard to be in the lime light of the company, being that your not particulary 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."
  200.         elif [ "$INT" -le "17" ]; then
  201.             echo "Being that your a woman and the owner of your own company. Not many think that your 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 there advice. You may be no tech guru, but you sure as hell try."
  202.         else
  203.             echo "It's been rough being a woman, and being extremely intelligient. 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 to much. They know your not stupid and respect your decisions."
  204.         fi
  205.     elif [ "$JOB" == "Vice-President" ]; then
  206.         if [ "$INT" == "3" ]; then
  207.             echo "completely and utter failure $JOB"
  208.         elif [ "$INT" -le "14" ]; then
  209.             echo "Dumb $JOB"
  210.         elif [ "$INT" -le "17" ]; then
  211.             echo "Semi-smart $JOB"
  212.         else
  213.             echo "Smart $JOB"
  214.         fi
  215.     elif [ "$JOB" == "HumanResources" ]; then
  216.         if [ "$INT" == "3" ]; then
  217.             echo "completely and utter failure $JOB"
  218.         elif [ "$INT" -le "14" ]; then
  219.             echo "Dumb $JOB"
  220.         elif [ "$INT" -le "17" ]; then
  221.             echo "Semi-smart $JOB"
  222.         else
  223.             echo "Smart $JOB"
  224.         fi
  225.     elif [ "$JOB" == "ITManager" ]; then
  226.         if [ "$INT" == "3" ]; then
  227.             echo "completely and utter failure $JOB"
  228.         elif [ "$INT" -le "14" ]; then
  229.             echo "Dumb $JOB"
  230.         elif [ "$INT" -le "17" ]; then
  231.             echo "Semi-smart $JOB"
  232.         else
  233.             echo "Smart $JOB"
  234.         fi
  235.     elif [ "$JOB" == "TechSupport" ]; then
  236.         if [ "$INT" == "3" ]; then
  237.             echo "completely and utter failure $JOB"
  238.         elif [ "$INT" -le "14" ]; then
  239.             echo "Dumb $JOB"
  240.         elif [ "$INT" -le "17" ]; then
  241.             echo "Semi-smart $JOB"
  242.         else
  243.             echo "Smart $JOB"
  244.         fi
  245.     elif [ "$JOB" == "SalesFloorEmployee" ]; then
  246.         if [ "$INT" == "3" ]; then
  247.             echo "completely and utter failure $JOB"
  248.         elif [ "$INT" -le "14" ]; then
  249.             echo "Dumb $JOB"
  250.         elif [ "$INT" -le "17" ]; then
  251.             echo "Semi-smart $JOB"
  252.         else
  253.             echo "Smart $JOB"
  254.         fi
  255.     fi
  256. else
  257.  
  258.     if [ "$JOB" == "CEO" ]; then
  259.         if [ "$INT" == "3" ]; then
  260.             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. Unfortunantly 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."
  261.         elif [ "$INT" -le "14" ]; then
  262.             echo "You are the big cheese, the boss to end all bosses. Those IT guys and there thingy majigures 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."
  263.         elif [ "$INT" -le "17" ]; then
  264.             echo "Looking at your email you notice you've lost connection to the exchange server. Knowing thats 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."
  265.         else
  266.             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."
  267.         fi
  268.     elif [ "$JOB" == "Vice-President" ]; then
  269.         if [ "$INT" == "3" ]; then
  270.             echo "completely and utter failure $JOB"
  271.         elif [ "$INT" -le "14" ]; then
  272.             echo "Dumb $JOB"
  273.         elif [ "$INT" -le "17" ]; then
  274.             echo "Semi-smart $JOB"
  275.         else
  276.             echo "Smart $JOB"
  277.         fi
  278.     elif [ "$JOB" == "HumanResources" ]; then
  279.         if [ "$INT" == "3" ]; then
  280.             echo "completely and utter failure $JOB"
  281.         elif [ "$INT" -le "14" ]; then
  282.             echo "Dumb $JOB"
  283.         elif [ "$INT" -le "17" ]; then
  284.             echo "Semi-smart $JOB"
  285.         else
  286.             echo "Smart $JOB"
  287.         fi
  288.     elif [ "$JOB" == "ITManager" ]; then
  289.         if [ "$INT" == "3" ]; then
  290.             echo "completely and utter failure $JOB"
  291.         elif [ "$INT" -le "14" ]; then
  292.             echo "Dumb $JOB"
  293.         elif [ "$INT" -le "17" ]; then
  294.             echo "Semi-smart $JOB"
  295.         else
  296.             echo "Smart $JOB"
  297.         fi
  298.     elif [ "$JOB" == "TechSupport" ]; then
  299.         if [ "$INT" == "3" ]; then
  300.             echo "completely and utter failure $JOB"
  301.         elif [ "$INT" -le "14" ]; then
  302.             echo "Dumb $JOB"
  303.         elif [ "$INT" -le "17" ]; then
  304.             echo "Semi-smart $JOB"
  305.         else
  306.             echo "Smart $JOB"
  307.         fi
  308.     elif [ "$JOB" == "SalesFloorEmployee" ]; then
  309.         if [ "$INT" == "3" ]; then
  310.             echo "completely and utter failure $JOB"
  311.         elif [ "$INT" -le "14" ]; then
  312.             echo "Dumb $JOB"
  313.         elif [ "$INT" -le "17" ]; then
  314.             echo "Semi-smart $JOB"
  315.         else
  316.             echo "Smart $JOB"
  317.         fi
  318.     fi
  319.  
  320. fi
  321.  
  322. ##Beginning of code Save block, should do some checks to see if human is present and such##
  323. read -p "Would you like to save this? n/y: " SAVE
  324.  
  325. FILENAME="./human/$NAME.txt"
  326. if [ -d ./human ]; then
  327.         if [ "$SAVE" == "y" ]; then
  328.                 if [ -f "$FILENAME" ]; then
  329.                         read -p "This file exists, would you like to overwrite? y/n: " overwrite
  330.                         if [ "$overwrite" == "y" ]; then
  331.                                 rm ./human/$NAME.txt
  332.                                 saveFunction
  333.                                 exit
  334.                         fi
  335.                 else
  336.                         saveFunction
  337.                 fi
  338.         else
  339.                 exit
  340.         fi
  341. else
  342.         mkdir ./human
  343.         saveFunction
  344. fi
Advertisement
Add Comment
Please, Sign In to add comment