Fix variable quoting.
This commit is contained in:
parent
642958ec6e
commit
cafba67089
1 changed files with 8 additions and 8 deletions
16
fetch_fio.sh
16
fetch_fio.sh
|
@ -93,11 +93,11 @@ fi
|
|||
#
|
||||
# Very simple "logging" function (stdout should be redirected to log anyway)
|
||||
log() {
|
||||
echo `date '+%Y-%m-%d %H:%M:%S'` $@
|
||||
echo `date '+%Y-%m-%d %H:%M:%S'` "$@"
|
||||
}
|
||||
|
||||
# Mark
|
||||
log $0 ======== started ========
|
||||
log "$0" ======== started ========
|
||||
|
||||
# Each line should contain account number and Fio API token as first
|
||||
# two non-whitespace strings. The rest of each line is ignored. There
|
||||
|
@ -114,11 +114,11 @@ while read accnt; do
|
|||
# Fetch CSV from bank
|
||||
CSVNAME="$BANK_DIR/$ACCNO.csv"
|
||||
for i in `seq 1 3` ; do
|
||||
if wget -q $APIURI/periods/${APIKEY}/2015-01-01/2025-01-31/transactions.csv -O $CSVNAME.tmp ; then
|
||||
if [ -s $CSVNAME.tmp ] ; then
|
||||
if wget -q "${APIURI}/periods/${APIKEY}/2015-01-01/2025-01-31/transactions.csv" -O "$CSVNAME.tmp" ; then
|
||||
if [ -s "$CSVNAME.tmp" ] ; then
|
||||
log Download OK
|
||||
cp $CSVNAME $CSVNAME.old
|
||||
mv $CSVNAME.tmp $CSVNAME
|
||||
cp "$CSVNAME" "$CSVNAME.old"
|
||||
mv "$CSVNAME.tmp" "$CSVNAME"
|
||||
log Finished
|
||||
break
|
||||
else
|
||||
|
@ -130,7 +130,7 @@ while read accnt; do
|
|||
sleep 5
|
||||
fi
|
||||
done
|
||||
done < $APIKEYS_FILE
|
||||
done < "$APIKEYS_FILE"
|
||||
|
||||
# Mark
|
||||
log $0 finished
|
||||
log "$0" finished
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue