How to cURL JAR from a remote url

I have a JAR available for download from an HTTP URL, say http://somerepo.example.org/myjar-1.0.jar .

I need a cURL command that will load it into the current directory; my best attempt:

 curl -i -H "Accept: application/zip" -H "Content-Type: application/zip" -X GET http://somerepo.example.org/myjar-1.0.jar 

When I run this console, it is populated with binary spam and seems to cause my entire terminal to melt.

What is the correct cURL command to get JAR from remote URL?

+6
source share
1 answer

You are almost there. By default, cURL will print to STDOUT. You want to redirect this to a file like this:

 curl -H "Accept: application/zip" http://somerepo.example.org/myjar-1.0.jar > myfile.jar 

You can also use the -o option:

 curl -H "Accept: application/zip" http://somerepo.example.org/myjar-1.0.jar -o myfile.jar 

You can also use wget

 wget http://somerepo.example.org/myjar-1.0.jar 
+12
source

Source: https://habr.com/ru/post/987070/


All Articles