我在从Linux主机上运行jq
时遇到问题。我不明白为什么。
$ uname -a
Linux localhost.localdomain 5.3.8-200.fc30.x86_64 #1 SMP Tue Oct 29 14:46:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
モ cat /etc/redhat-release
Fedora release 30 (Thirty)
$ echo $SHELL
/bin/bash
$ file $(which jq)
/usr/bin/jq: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=aca83aa7ecf04e5385c4cc94657cfc9ea1df86d3, stripped
$ jq --version
jq-1.6
$ echo '{}' | jq .
jq: error: syntax error, unexpected INVALID_CHARACTER, expecting $end (Unix shell quoting issues?) at <builtin>, line 1:
ELF
jq: 1 compile error
答案 0 :(得分:0)
当我尝试在Linux上使用CR / LF行尾的.jq
文件时,这发生在我身上。将其更改为LF可解决此问题。