Ezzmazz
Ezzmazz

Reputation: 133

Curl : problem when I try to redirect output to file

I use this curl command to download a setup.exe :

curl -k -u login:Password -O "https://url/to/my/setup.exe"

I want to get the time total :

curl -s -w 'total : %{time_total}\n' -k -u login:Password -O "https://url/to/my/setup.exe"
total : 41.165108

I want to redirect the output ( total : 41.165108 ) in an external file. I try :

curl -o test.txt -s -w 'total : %{time_total}\n' -k -u login:Password -O "https://url/to/my/setup.exe"
curl -s -w 'total : %{time_total}\n' -k -u login:Password -O "https://url/to/my/setup.exe" > test.txt

But it doesn't work...

Someone to show me ?

Thanks !

Upvotes: 0

Views: 253

Answers (2)

Shaqil Ismail
Shaqil Ismail

Reputation: 1951

The -o parameter is in lowercase, and the file to output to, is to be entered after the parameter, an example is below,

curl -K myconfig.txt -o output.txt

Upvotes: 0

choroba
choroba

Reputation: 241738

Just combine the two things you've tried:

curl -s -w 'total : %{time_total}\n' -k -u login:Password \
    -O "https://url/to/my/setup.exe" -o setup.exe > total.txt
#                                    ~~~~~~~~~~~~ ~~~~~~~~~~~
  • setup.exe will contain the downloaded file
  • total.txt will contain the total

The -o doesn't influence where the output of -w goes.

Upvotes: 1

Related Questions