Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide status output from jq in dos/windows

I'm using curl for windows (http://www.confusedbycode.com/curl/) in conjunction with jq (http://stedolan.github.io/jq/) to interact with a web api via a batch file. The seemingly simple problem I'm having is that no matter what I do, I cannot seem to suppress JQ's "status" output. In particular, it always outputs "progress status," like:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
100   116  100    99  100    17    908    155 --:--:-- --:--:-- --:--:--   908

A simplified example batch file would be:

@echo off
@curl.exe -H "Content-Type: application/json" -d '{\"cmd\":\"login\"}' http://localhost:80/json | jq -r .session > sess.txt

Note that jq does operate as expected - I simply need to get it to operate silently. It seems to ignore @echo off, and I couldn't find any switches in the manual to disable this output.

Any ideas...?

Thanks much in advance :)

like image 398
Metal450 Avatar asked Dec 03 '14 00:12

Metal450


1 Answers

curl --silent
-s, --silent
  Silent or quiet mode. Do not show progress meter or error messages. Makes Curl
  mute.
  • Example
  • explainshell.com - curl --silent
like image 110
Zombo Avatar answered Oct 12 '22 05:10

Zombo