1

Issue : Without a pipe symbol after the curl command, the output of the curl command is curl: (21) QUOT command failed with 550.

With a pipe symbol, curl detects it is not outputting to the terminal and inserts a progress-meter.

To disable the progress-meter I tried using the s flag, However using the s flag also prevents curl: (21) QUOT command failed with 550 from being out-putted.

I want curl to continue outputting the curl: (21) QUOT command failed with 550 the same way it outputs it in the terminal, but I do not want it to output the progress-meter.

The code : ( with s flag )

curl -ls -Q "DELE $remote_file" $remote_server | sed -r '/^\.{1,2}$/d'

Extra information :
Perhaps this is not relavant to the question :
The sed code : removes the . and the .. from the output.

Update :
The protocol that is used is ftp.

  • 1
    When you use a pipe you are piping stdout. That error though is being sent out through stderr. The terminal shows both outputs. [Check out this answer for how to pipe stderr](https://stackoverflow.com/questions/2342826/how-to-pipe-stderr-and-not-stdout/23163017) – JNevill Oct 03 '19 at 13:18
  • @JNevill, I tried `curl -l -Q "DELE $remote_file" $remote_server 2>&1 >/dev/null | sed -r '/^\.{1,2}$/d'` , however the progress-meter is still being printed out. – Sümer Kolçak Oct 03 '19 at 13:23
  • 3
    Try `curl -Ss`. And send a bug report upstream. The fact that curl behaves this way is a tragedy, and has been for years. If more people complain about it, perhaps it will change. – William Pursell Oct 03 '19 at 13:35
  • Can you let us know which protocol is referenced by "$remote_server" ? FTP and HTTP behavior is different ? – dash-o Oct 03 '19 at 14:50
  • @dash-o, an update has been added to the question, the protocol that is being used is `ftp`. – Sümer Kolçak Oct 03 '19 at 15:27
  • @William Pursell, your answer worked, and there does not seem to be a need for `2>&1 >/dev/null` , if you had posted your comment as an answer, I would have chosen it as the "selected answer" – Sümer Kolçak Oct 03 '19 at 15:37

1 Answers1

3

The flag you are looking for is -sS. From man curl:

   -s, --silent
          Silent  or  quiet  mode.  Don't  show progress meter or error messages.  Makes Curl mute. It will still output the data you ask for, potentially even to the terminal/stdout
          unless you redirect it.

          Use -S, --show-error in addition to this option to disable progress meter but still show error messages.

          See also -v, --verbose and --stderr.
accdias
  • 5,160
  • 3
  • 19
  • 31