22 lines
392 B
Bash
22 lines
392 B
Bash
|
# Shows name for given level
|
||
|
|
||
|
if [ $# -ne 2 ]; then
|
||
|
echo "usage: ./getname world_num level_num"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
WORLD=$1
|
||
|
LEVEL=$2
|
||
|
|
||
|
ADJWORLD=`expr $WORLD - 1`
|
||
|
ADJLEVEL=`expr $LEVEL - 1`
|
||
|
|
||
|
LINE1=`expr $ADJWORLD \* 20 + $ADJLEVEL`
|
||
|
LINE=`expr $LINE1 + 1`
|
||
|
|
||
|
NAMELINE=`head -n $LINE data/map.dat | tail -n 1`
|
||
|
NAME=`echo $NAMELINE | awk -F',' '{print $3}'`
|
||
|
|
||
|
#echo Level $WORLD-$LEVEL is $NAME
|
||
|
echo $NAME
|