knoguchi / grafana-dash

A utility to update Grafana dashboards
Apache License 2.0
10 stars 4 forks source link

/usr/bin/env: ‘jq -Mf’: No such file or directory #2

Closed tmor closed 4 years ago

tmor commented 4 years ago

Summary

On Linux, /usr/bin/env command with -option will not work.

Environments

Steps to reproduce

./update-datasource.jq --arg old "old datasource name" --arg new "new datasource name" < my_dashboard.json > edited_my_dashboard.json
...
/usr/bin/env: ‘jq -Mf’: No such file or directory

Workaround

jq -Mf update-datasource.jq  ...
knoguchi commented 4 years ago

It's not env but the older jq that doesn't take -Mf option. I will modify the README so it works for older jq.

tmor commented 4 years ago

It's not env but the older jq that doesn't take -Mf option. I will modify the README so it works for older jq.

I'm using jq-1.6 . macOS is BSD-based, shebang supports multiple options. However, Linux does not support it.

please see here: いまさら聞けない、#! で始まる1行目の名前とenv指定時の挙動 - 基本へ帰ろう

knoguchi commented 4 years ago

ah. you are right. env -S would do if your Linux uses GNU coreutils v8.30 or newer.

knoguchi commented 4 years ago

Fixed the readme and the script.