pass team code as flag
This commit is contained in:
parent
6f25185b92
commit
5980c56e71
16
content.sh
16
content.sh
|
@ -1,7 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
gamePk=$(./livepk.sh)
|
while getopts 't:' opt
|
||||||
if [[ "$gamePk" = 'null' ]]
|
do
|
||||||
|
case $opt in
|
||||||
|
t)
|
||||||
|
team=$OPTARG
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
gamePk=$(./livepk.sh -t $team)
|
||||||
|
if [[ -z $gamePk || "$gamePk" = 'null' ]]
|
||||||
then
|
then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
20
livepk.sh
20
livepk.sh
|
@ -1,4 +1,22 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
while getopts 't:' opt
|
||||||
|
do
|
||||||
|
case $opt in
|
||||||
|
t)
|
||||||
|
team=$OPTARG
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z $team ]]
|
||||||
|
then
|
||||||
|
echo "$0:" '-t is required' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# grab most recently started live pk, if multiple
|
# grab most recently started live pk, if multiple
|
||||||
echo $(mlblive schedule -t $TEAM | jq '.dates[].games | map(select(.status.abstractGameState == "Live"))[-1].gamePk')
|
echo $(mlblive schedule -t $team | jq '.dates[].games | map(select(.status.abstractGameState == "Live"))[-1].gamePk')
|
||||||
|
|
16
subscribe.sh
16
subscribe.sh
|
@ -1,7 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
gamePk=$(./livepk.sh)
|
while getopts 't:' opt
|
||||||
if [[ "$gamePk" = 'null' ]]
|
do
|
||||||
|
case $opt in
|
||||||
|
t)
|
||||||
|
team=$OPTARG
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
gamePk=$(./livepk.sh -t $team)
|
||||||
|
if [[ -z $gamePk || "$gamePk" = 'null' ]]
|
||||||
then
|
then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue