diff options
Diffstat (limited to 'tmux/vcs_info.sh')
-rwxr-xr-x | tmux/vcs_info.sh | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tmux/vcs_info.sh b/tmux/vcs_info.sh index 673c07e..88c9e92 100755 --- a/tmux/vcs_info.sh +++ b/tmux/vcs_info.sh @@ -73,29 +73,34 @@ function get_eth_price { # eth_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price") # cake_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price") # monero_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price") - if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_ETH ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + if [ $(($(stat --format=%Y $PRICE_CACHE_OUTPUT_ETH) + PRICE_TIME_CACHE)) -gt "$(date +%s)" ]; then : else - if ETH_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price"); then - echo "${ETH_OUTPUT}" > ${PRICE_CACHE_OUTPUT_ETH} + if ETH_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price"); then + if [ -n "${ETH_OUTPUT}" ]; then + echo "${ETH_OUTPUT}" >${PRICE_CACHE_OUTPUT_ETH} + fi fi fi - if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_CAKE ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + if [ $(($(stat --format=%Y $PRICE_CACHE_OUTPUT_CAKE) + PRICE_TIME_CACHE)) -gt "$(date +%s)" ]; then : else - if CAKE_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price"); then - echo "${CAKE_OUTPUT}" > ${PRICE_CACHE_OUTPUT_CAKE} + if CAKE_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price"); then + if [ -n "${CAKE_OUTPUT}" ]; then + echo "${CAKE_OUTPUT}" >${PRICE_CACHE_OUTPUT_CAKE} + fi fi fi - if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_XMR ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + if [ $(($(stat --format=%Y $PRICE_CACHE_OUTPUT_XMR) + PRICE_TIME_CACHE)) -gt "$(date +%s)" ]; then : else - if XMR_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price"); then - echo "${XMR_OUTPUT}" > ${PRICE_CACHE_OUTPUT_XMR} + if XMR_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price"); then + if [ -n "${XMR_OUTPUT}" ]; then + echo "${XMR_OUTPUT}" >${PRICE_CACHE_OUTPUT_XMR} + fi fi fi - result="$(cat ${PRICE_CACHE_OUTPUT_ETH})"/"$(cat ${PRICE_CACHE_OUTPUT_CAKE})"/"$(cat ${PRICE_CACHE_OUTPUT_XMR})" echo "${result}" } |