Unix & Linux Asked by OttoEisen on January 12, 2021
I’m trying to make a bash script written for BSD work on Linux, in case that’s relevant. Now I’m stumbling over this line:
json="$(sudo -u "${vpnUser}" -- curl --interface "${adaptorName}" --get --insecure --silent --show-error --fail --location --max-time "${curlMaxTime}" --data-urlencode "token=${authToken}" "https://${gatewayAddress}:19999/getSignature" | jq -Mre)"
I’ve echo’ed the values of the variables from the script and they look fine. Then I replaced the variables with the values. Then jq seems to complain about a syntax error (generic Usage:
output) and curl, I assume, says (23) Failed writing body
.
If a just run the command like sudo -u ... | jq -Mre
it prints what looks like a JSON file.
Never mind! I got curious why the author would pipe the output through a parser which basically doesn’t do anything to the data, it only formats it into a more readable, multi-line output. And I assume that the multi-line format is the problem here? Removing everything after | helped.
Now another question: does anybody know if the original version is supposed to work with a BSD bash? Or should I tell the author (which states "…specifically in FreeBSD" in the comments) about this?
Never mind! Had an Irish Coffee and looked into jq
a bit, and got curious why the author would pipe the output through a parser which basically doesn't do anything to the data, it only formats it into a more readable, multi-line output. And I assume that the multi-line format is the problem here? Removing everything after |
helped.
Answered by OttoEisen on January 12, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP