Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- first=""
- var=""
- if [ -n "$2" ];then
- limit=$2
- else
- limit=10000
- fi
- if [ -n "$1" ];then
- case $1 in
- -c) field=3; type="total cost";;
- -s) field=7; type="total skillpoints";;
- -q) field=6; type="total questpoints";;
- -m) field=8; type="total maxstats";;
- -g) field=4; type="total gold";;
- *) echo "Usage: $0 [-g|-m|-q|-s|-c] [limit levels]. g=gold, q=questpoints, s=skillpoints, m=maxstats, c=xp cost."; exit 1;;
- esac
- else
- field=7; type="total skillpoints"
- fi
- for x in $(cat levels |tr -s ' ' |cut -d\ -f$field |head -n $limit);do
- if [ -z "$first" ];then
- var="$x"
- first="y"
- else
- var="$var+$x"
- fi
- done
- echo "$type: $(echo "$var" |bc)"
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement