-2

I've redirected a script stdout and stderr into different log files like this:

bash run.sh > out.log 2>err.log &

I've some curl requests in my script that outputs progress state into stderr like this:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   210  100   210    0     0    294      0 --:--:-- --:--:-- --:--:--   294

This makes the log files full of useless data. How can I disable this, so that I can assume stderr would have only errors.

amrezzd
  • 1,787
  • 15
  • 38
  • 2
    To any tool writers, please take this question as yet another data point to support the (often ignored) long time best practice: succeed quietly, fail loudly. That this progress banner is on by default instead of only activated by `--verbose` or similar is an atrocity. – William Pursell May 15 '21 at 14:29
  • 1
    @WilliamPursell Yeah I didn't even expect the progress to be logged into "error channel"! – amrezzd May 15 '21 at 14:31

1 Answers1

1

Use curl -s (or --silent) to suppress the progress bar. Add -S (or --show-error) to still get error messages printed to stderr.

choroba
  • 231,213
  • 25
  • 204
  • 289
  • @amirz98: Unfortunately, there are only 2 standard output handles, stdout and stderr. Maybe they should've created stdwarn and stdinfo, too, but they didn't. – choroba May 15 '21 at 14:32