matryer / xbar

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)
https://xbarapp.com
MIT License
17.56k stars 643 forks source link

jq not working #732

Closed peha2407 closed 3 years ago

peha2407 commented 3 years ago

Hi matryer I am very enthusiastic about xbar. But now I have a problem: For a script I have brewed "jq" with homebrew. This command is executed in the terminal, but not by xbar. The script I run is called:

!/bin/bash

echo "SMA 🌡" echo "---" echo -n "SMA: " > /Users/peter/Library/Caches/SMA.txt; curl -s "https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=SMA" | jq | grep "temperature" | cut -c20- | rev | cut -c2- |rev >> /Users/peter/Library/Caches/SMA.txt; echo $(cat -s /Users/peter/Library/Caches/SMA.txt)"°C" exit 0 The command "jq" is not executed, the menu displays "SMA 🌡" and then "SMA: °C" instead of, for example, "SMA: 18.3°C". What can I do?

jsok commented 3 years ago

I found that I needed to add $(brew --prefix)/bin to the PATH in my script. Alternatively you can hardcode it like /usr/local/bin/jq.

peha2407 commented 3 years ago

Yes, I have hardecoded it now, and it works like a charm. Thanks!

Am 30.06.2021 um 07:33 schrieb Jonathan Sokolowski @.***>:

I found that I needed to add $(brew --prefix)/bin to the PATH in my script. Alternatively you can hardcode it like /usr/local/bin/jq.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/matryer/xbar/issues/732#issuecomment-871108941, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT7L4R66ZXAM3TMGSISBEDTVKUBFANCNFSM47HOFNHA.

matryer commented 3 years ago

Closing. :)