2

I'm using Curl on a site that returns the cookie upon login. In the command line (cygwin) I'd like to output the cookie data to the clipboard.

Typically I would use

> /dev/clipboard 

at the end of the command but that doesn't seem to work for the cookie data. The only way it seems I can output the cookie jar data is by using

curl --cookie-jar cookies.txt

This puts in a text file which I'd rather not do. Would appreciate any advice.

user2029890
  • 2,493
  • 6
  • 34
  • 65

2 Answers2

1

If you have a shell that is able to do that, you can do various things:

# Use xclip Linux utility
curl -c >(xclip -i) example.com
# Use Windows' /dev/clipboard
curl -c /dev/clipboard example.com

Or if you can access /dev/fd or /proc filesystems (not sure for CygWin), you can utilize those

curl -c /dev/fd/4 example.com 4>/dev/clipboard

But other than using your shell I'm not aware of curl being able to store the cookies anywhere else than in a file. And I don't think you're looking for script workarounds.

nert
  • 942
  • 6
  • 17
0

This actually seems to work fine: curl --cookie-jar /dev/clipboard www.google.com

aikeru
  • 3,773
  • 3
  • 33
  • 48