Change the behavior of script with no player.
This commit is contained in:
parent
d34236e105
commit
99520efaec
23
schedule.sh
23
schedule.sh
@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
myname=iVS
|
|
||||||
repo=fat0troll/lorchess
|
repo=fat0troll/lorchess
|
||||||
tournament=autumn2013
|
tournament=autumn2013
|
||||||
|
|
||||||
@ -20,13 +19,11 @@ args=$(getopt --options p: --longoptions player: -- "$@")
|
|||||||
# Note the quotes around `$ARGS': they are essential!
|
# Note the quotes around `$ARGS': they are essential!
|
||||||
eval set -- "$args"
|
eval set -- "$args"
|
||||||
|
|
||||||
if [[ $1 == -p ]] || [[ $1 == --player ]]; then
|
if [[ $1 == -p || $1 == --player ]];then
|
||||||
name=$2
|
name=$2
|
||||||
shift 3
|
shift 2
|
||||||
else
|
|
||||||
name=$myname
|
|
||||||
shift
|
|
||||||
fi
|
fi
|
||||||
|
shift
|
||||||
|
|
||||||
for tour in $@; do
|
for tour in $@; do
|
||||||
# Change tour numbers: `1' -> `01', `2' -> `02', and so on
|
# Change tour numbers: `1' -> `01', `2' -> `02', and so on
|
||||||
@ -36,10 +33,14 @@ for tour in $@; do
|
|||||||
url=https://raw.github.com/$repo/master/$tournament/tour_$tour/tour_info
|
url=https://raw.github.com/$repo/master/$tournament/tour_$tour/tour_info
|
||||||
|
|
||||||
echo ">>>"
|
echo ">>>"
|
||||||
curl -q --silent $url | egrep "Тур|Время|$name" | while read line;do
|
curl -q --silent $url | while read line;do
|
||||||
# Colorize output
|
if [[ -z $line ]];then
|
||||||
line=$(echo $line | sed "s/${score}/${green}\0${restore}/g")
|
echo
|
||||||
line=$(echo $line | sed "s/${name}/${red}\0${restore}/g")
|
elif [[ -z $name || `echo "$line" | egrep "Тур|=|Время|$name"` ]];then
|
||||||
echo -e $line
|
# Colorize output
|
||||||
|
line=$(echo "$line" | sed "s/${score}/${green}\0${restore}/g")
|
||||||
|
[[ -n $name ]] && line=$(echo "$line" | sed "s/${name}/${red}\0${restore}/g")
|
||||||
|
echo -e $line
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user