Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't know about the version of curl you use, but mine doesn't give download progress in binary format, and doesn't contain any content of the target you're curling.

    $ curl news.ycombinator.com > /dev/null
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   178    0   178    0     0    369      0 --:--:-- --:--:-- --:--:--   370
You have to add an extra arg to get rid of that progress meter.



The behavior doesn't exactly switch on pipe detection though. The progress bar consistently shows when outputting to a file.

  $ curl news.ycombinator.com -o /dev/null
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  100   178    0   178    0     0    948      0 --:--:-- --:--:-- --:--:--   951
I mean, it's effectively doing tty detection, but I think it's fair to argue a semantic difference, and it's very similar to how ls strips colors and disables listing format when piped, which is mentioned by the next paragraph in the coding standards.

Compatibility requires certain programs to depend on the type of output device. It would be disastrous if ls or sh did not do so in the way all users expect. In some of these cases, we supplement the program with a preferred alternate version that does not depend on the output device type. For example, we provide a dir program much like ls except that its default output format is always multi-column format.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: