xbar: jq: command not found, even though installed on system?
my code:
echo -n "E:"; curl -s "https://api.gdax.com/products/ETH-USD/ticker" | jq -r '.bid'
which jq
/usr/local/bin/jq
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16
Provide the absolute path to
jq
:which -a jq
will show something like e.g.:Now instead of
jq -r ".bid"'
use/usr/local/bin/jq -r ".bid"
Why should I use an absolute path?
Because xbar/bitbar does not use your user’s
$PATH
environment, and instead uses a restricted env that does not include/usr/local/bin
in the$PATH
(similar to the envcrontab
uses). If you do want to use your user’s environment then do it explicitly at the top of the script withsource ~/.bashrc
(if using bash) orsource ~/.zshrc
(if using zsh) — but be aware that this might slow down your scripts depending on what you have in your shell config files. A better, safer and faster alternative would be to put at the top of your scriptAha, I missed your
|
. Try this/usr/bin/sudo -u you -i bash -c 'echo -n "E:"; curl -s "https://api.gdax.com/products/ETH-USD/ticker" | jq -r ".bid"'