diff options
| author | Anton Bobov <abobov@gmail.com> | 2016-07-25 13:42:24 +0500 |
|---|---|---|
| committer | Anton Bobov <abobov@gmail.com> | 2016-07-25 13:42:24 +0500 |
| commit | b7731a8240ddfa73ece9d5e052fe59c6b58b8771 (patch) | |
| tree | 89cc8e760a809e7d9bbc0e68a19b0834699be191 | |
| parent | 5cfe5ab48aec461e84514e43aa97e04ff8bbf808 (diff) | |
Fix empty lines in price.db when no exchange rate was returned.
| -rwxr-xr-x | ledger-price-db-update.sh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ledger-price-db-update.sh b/ledger-price-db-update.sh index ff10504..084b27c 100755 --- a/ledger-price-db-update.sh +++ b/ledger-price-db-update.sh @@ -17,5 +17,8 @@ xe() { curl -s "http://download.finance.yahoo.com/d/quotes.csv?s=$1&f=p" } -echo P $(date +"%Y/%m/%d %H:%M:%S") \$ $(xe "USDRUB=X") R >> "$PRICE_DB_FILE" -echo P $(date +"%Y/%m/%d %H:%M:%S") € $(xe "EURRUB=X") R >> "$PRICE_DB_FILE" +usd=$(xe "USDRUB=X") +eur=$(xe "EURRUB=X") + +test -n "$usd" && echo P $(date +"%Y/%m/%d %H:%M:%S") \$ $usd R >> "$PRICE_DB_FILE" +test -n "$eur" && echo P $(date +"%Y/%m/%d %H:%M:%S") € $eur R >> "$PRICE_DB_FILE" |
