#!/bin/bash exclude_list="" isExclude() { for y in $exclude_list do if [[ "part$y.txt" == "$1" ]]; then return 0 fi done return 1 } BASE_DIR="$(cd $(dirname $0); pwd)" INSTALL_DIR="$BASE_DIR/../app/src/main/assets" ASSETS_DIR="$BASE_DIR/assets" TMP="$BASE_DIR/out.tmp" OUT_PREFIX="$ASSETS_DIR/game_" OUT_EASY=${OUT_PREFIX}easy OUT_MEDIUM=${OUT_PREFIX}medium OUT_HARD=${OUT_PREFIX}hard L=$(ls $BASE_DIR/part*.txt -l | wc -l) L=$(( $L - 1 )) generate() { in=$1 out=$2 TIME=$3 file=$(cat $in) sed "s/\$TIME/$TIME/g" "$in" > $out } cat $BASE_DIR/prefix.txt > $TMP i=0 for x in $(ls $BASE_DIR/part*.txt) do if ! isExclude $x ; then cat $x >> $TMP if [ "$i" -lt "$L" ]; then echo "," >> $TMP fi fi i=$(( $i + 1 )) done cat $BASE_DIR/suffix.txt >> $TMP cat $TMP | head generate $TMP $OUT_EASY 60 cat $OUT_EASY | grep max_time generate $TMP $OUT_MEDIUM 45 cat $OUT_MEDIUM | grep max_time generate $TMP $OUT_HARD 30 cat $OUT_HARD | grep max_time rm -rf $INSTALL_DIR $TMP cp -r $ASSETS_DIR $INSTALL_DIR