Home > Back-end >  Why won't curl download this image?
Why won't curl download this image?

Time:07-20

I'm trying to download the image located at this URL https://www.augsburger-allgemeine.de/img/panorama/crop61911941/0409422329-cv16_9-w940-owebp/Wassermassen-in-Australien?t=.jpg with curl, i.e:

curl -O https://www.augsburger-allgemeine.de/img/panorama/crop61911941/0409422329-cv16_9-w940-owebp/Wassermassen-in-Australien?t=.jpg

But I just get:

zsh: no matches found: https://www.augsburger-allgemeine.de/img/panorama/crop61911941/0409422329-cv16_9-w940-owebp/Wassermassen-in-Australien?t=.jpg

Can anyone explain to me why this is happening?

CodePudding user response:

Analysis

In terms of zsh the question mark (?) is a wildcard character.

Let's refer to the documentation.

zsh: 14 Expansion: 14.8 Filename Generation:

14.8 Filename Generation

If a word contains an unquoted instance of one of the characters ‘ *’, ‘(’, ‘|’, ‘<’, ‘[’, or ‘?’, it is regarded as a pattern for filename generation, unless the GLOB option is unset. If the EXTENDED_GLOB option is set, the ‘^’ and ‘#’ characters also denote a pattern; otherwise they are not treated specially by the shell.

<…>

Please, note:

If a word contains an unquoted instance

zsh: 14 Expansion: 14.8.1 Glob Operators:

14.8.1 Glob Operators

<…>

? Matches any character.

<…>

Possible solution

Surround each argument containing wildcard characters with quotes (single quotes or double quotes), so that the argument is not regarded as a pattern for file name generation.

For example:

curl -O 'https://www.augsburger-allgemeine.de/img/panorama/crop61911941/0409422329-cv16_9-w940-owebp/Wassermassen-in-Australien?t=.jpg'
  • Related