Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- filename="$1"
- total=0
- rane=0
- foul=0
- dagon=0
- talwin=0
- while read -r line
- do
- name="$line"
- char=`echo $line |cut -d ' ' -f 1`
- ore=`echo $line |cut -d ' ' -f 2`
- amount=`echo $line |cut -d ' ' -f 3`
- if echo $ore |grep -q "Lavish" ; then
- S=$(echo "$amount*1.15"| bc )
- amount=`echo ${S%.*}`
- elif echo $ore |grep -q "Replete" ; then
- S=$(echo "$amount*1.15"| bc )
- amount=`echo ${S%.*}`
- fi
- temp=$((total+amount))
- total=$temp
- if echo $char|grep -q "Moon"; then
- rane=$((rane+amount))
- elif echo $char|grep -q "Niminen"; then
- talwin=$((talwin+amount))
- elif echo $char|grep -q "KaTecho"; then
- foul=$((foul+amount))
- elif echo $char|grep -q "FOULPLAY75"; then
- foul=$((foul+amount))
- elif echo $char|grep -q "Dagon"; then
- dagon=$((dagon+amount))
- elif echo $char|grep -q "Dagon"; then
- dagon=$((dagon+amount))
- elif echo $char|grep -q "Rob-Halford"; then
- dagon=$((dagon+amount))
- elif echo $char|grep -q "DefenderoftheFaith"; then
- dagon=$((dagon+amount))
- elif echo $char|grep -q "Britishsteel"; then
- dagon=$((dagon+amount))
- elif echo $char|grep -q "SadWingsOfDestiny"; then
- dagon=$((dagon+amount))
- fi
- done < "$filename"
- echo "Rane mined : $rane"
- echo "Talwin mined: $talwin"
- echo "Foul mined: $foul"
- echo "Dagon mined: $dagon"
- echo "The total amount is: $total"
- tot=$((rane+talwin+dagon+foul))
- echo "total if adding all chars this and the above one should be the same: $tot"
- rane_per=$( echo "scale=3; $rane/$total*$2"| bc )
- echo "Ranes %: $rane_per"
- talwin_per=$( echo "scale=3; $talwin/$total*$2"| bc )
- echo "Talwins %: $talwin_per"
- foul_per=$( echo "scale=3; $foul/$total*$2"| bc )
- echo "Fouls %: $foul_per"
- dagon_per=$( echo "scale=3; $dagon/$total*$2"| bc )
- echo "Dagons %: $dagon_per"
- a=$(echo " scale=3; 1-$2"| bc )
- share=$(echo "scale=3; $total*$a"| bc )
- echo "Corps share in m3 is $share"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement