From a479d89d10b3137bc006b84a8ac3d924df8ae61d Mon Sep 17 00:00:00 2001 From: vonavi Date: Sun, 14 Dec 2014 12:26:28 +0300 Subject: [PATCH] Script 'game-add': assign the date of games to the date of the last game. --- game-add | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/game-add b/game-add index f8dcec9..cf42f60 100755 --- a/game-add +++ b/game-add @@ -125,7 +125,9 @@ function game_get_info { game_validate if ! $ADD_GAMES || [[ $game_date =~ \? ]]; then - local date=$(sed -En "s/\[Date \"([^\"]*)\"\]/\1/p" ${TMP_PGN_FILES[0]}) + # Assign the date of games to the date of the last game + local pgn_last=${TMP_PGN_FILES[${#TMP_PGN_FILES[@]} - 1]} + local date=$(sed -En "s/\[Date \"([^\"]*)\"\]/\1/p" $pgn_last) game_date=${date:8:2}.${date:5:2}.${date::4} fi }