Script 'game-add': cover the case when a player was not found in tour_info.
This commit is contained in:
parent
42f22c274e
commit
b681d32546
4
game-add
4
game-add
@ -112,8 +112,8 @@ function game_get_info {
|
|||||||
# Find the white and black players
|
# Find the white and black players
|
||||||
local line0=$(grep " ${players[0]} " $tour_info)
|
local line0=$(grep " ${players[0]} " $tour_info)
|
||||||
local line1=$(grep " ${players[1]} " $tour_info)
|
local line1=$(grep " ${players[1]} " $tour_info)
|
||||||
[[ $line0 == $line1 ]] \
|
[[ -z $line0 || -z $line1 || $line0 != $line1 ]] \
|
||||||
|| die "No game between ${players[0]} and ${players[1]} found in ${tour_info}."
|
&& die "No game between ${players[0]} and ${players[1]} found in ${tour_info}."
|
||||||
[[ $line0 =~ ^((${date_re})\ +([^\ ]+)\ +-\ +([^\ ]+))(.*)$ ]]
|
[[ $line0 =~ ^((${date_re})\ +([^\ ]+)\ +-\ +([^\ ]+))(.*)$ ]]
|
||||||
white=${BASH_REMATCH[3]}
|
white=${BASH_REMATCH[3]}
|
||||||
black=${BASH_REMATCH[4]}
|
black=${BASH_REMATCH[4]}
|
||||||
|
Loading…
Reference in New Issue
Block a user