-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
I'd expect curl -o to always create the specified file, if the url download succeeded. This consistency means it's easy to use it in a script; run curl, check its exit status and if it succeeded, the url content is there in the file to be used. And it just seems to make sense. But, reality is different when downloading an url that happens to be empty:
joey@darkstar:>curl -o hello http://tmp.kitenet.net/empty>cat hello
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:- 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:- 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
joey@darkstar:
cat: hello: No such file or directory
This behavior is not documented on the man page either. So you have either a behavior bug (IMHO) or at least a documentation bug.
I'm using curl 7.38.0.