How do you print received cookie info to stdout with curl?
According to the man pages if you use '-' as the file name for the -c --cookie-jar option it should print the cookie to stdout. The problem is I get an error:
curl: option -: is unknown
an example of the command I am running:
curl -c --cookie-jar - 'http://google.com'
You get that error because you use in the wrong way that option. When you see in a man page an option like:
-c, --cookie-jar <file name>
this mean that if you want to use that option, you must to use -c
OR --cookie-jar
, never both! These two are equivalent and, in fact, -c
is the abbreviated form for --cookie-jar
. There are many, many options in man pages which are designed in the same way.
In your case:
curl -c - 'http://google.com'
--cookie-jar
is given as argument for -c
option, so, it's interpreted as a file name, not like an option (as you may think), and -
remains alone which leads to error because curl
, indeed, doesn't have such an option.