如何在Git Bash執行jq ? (非WSL)
使用Windows的朋友如果需要在Git Bash上執行jq的指令可怎麼做呢?
jq 是甚麼? 以下是官方答案
- jq is like
sed
for JSON data - you can use it to slice and filter and map and transform structured data with the same ease thatsed
,awk
,grep
and friends let you play with text. - jq is written in portable C, and it has zero runtime dependencies. You can download a single binary,
scp
it to a far away machine of the same type, and expect it to work. - jq can mangle the data format that you have into the one that you want with very little effort, and the program to do so is often shorter and simpler than you'd expect.
如何在Linux Ubuntu上安裝?
sudo apt-get install jq
如何在Windows的Git Bash上安裝?
- 在git-bash.exe的資料夾內建立 usr/local/bin/ 資料夾
- 在Git Bash執行: curl -L -o /usr/local/bin/jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe
- 現在可執行 jq --version 查看安裝版本