LinuxForum.Fans
Тема

Как использовать CURL, если несколько опций (или необычная опция)?

Автор: ivan_lenon 2 сообщений 361 просмотров
10.07.2022 14:28 #437880

Здравствуйте, работаю на Ubuntu 20.04 в VirtualBox!

Подскажите, что делает команда:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg

а именно опции -fsSL ?

Данная команда взята отсюда:
docs.docker.com/engine/install/ubuntu/#set-up-the-repository

В качестве подсказки воспользовался:
losst.ru/kak-polzovatsya-curl


Если это набор опций, то:
-f - не выводить сообщения об ошибках;
-S - выводить сообщения об ошибках;

За ранее, благодарен.

10.07.2022 14:38 #437882

ivan_lenon, а если так сделать?
[console]man curl[/console]
Выход, если что, по клавише q :) .

Много букв :)
man curl написал:

-f, --fail
(HTTP) Fail silently (no output at all) on server errors. This is mostly done to enable scripts
etc to better deal with failed attempts. In normal cases when an HTTP server fails to deliver a
document, it returns an HTML document stating so (which often also describes why and more). This
flag will prevent curl from outputting that and return error 22.

This method is not fail-safe and there are occasions where non-successful response codes will slip
through, especially when authentication is involved (response codes 401 and 407).

Example:
curl --fail https://example.com

See also --fail-with-body.

-L, --location
(HTTP) If the server reports that the requested page has moved to a different location (indicated
with a Location: header and a 3XX response code), this option will make curl redo the request on
the new place. If used together with -i, --include or -I, --head, headers from all requested pages
will be shown. When authentication is used, curl only sends its credentials to the initial host.
If a redirect takes curl to a different host, it will not be able to intercept the user+password.
See also --location-trusted on how to change this. You can limit the amount of redirects to follow
by using the --max-redirs option.

When curl follows a redirect and if the request is a POST, it will send the following request with
a GET if the HTTP response was 301, 302, or 303. If the response code was any other 3xx code, curl
will re-send the following request using the same unmodified method.

You can tell curl to not change POST requests to GET after a 30x response by using the dedicated
options for that: --post301, --post302 and --post303.

The method set with -X, --request overrides the method curl would otherwise select to use.

Example:
curl -L https://example.com

See also --resolve and --alt-svc.

-S, --show-error
When used with -s, --silent, it makes curl show an error message if it fails.

This option is global and does not need to be specified for each use of -:, --next.

Example:
curl --show-error --silent https://example.com

See also --no-progress-meter.

-s, --silent
Silent or quiet mode. Do not 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.

Example:
curl -s https://example.com

See also -v, --verbose, --stderr and --no-progress-meter.
Войдите или зарегистрируйтесь, чтобы ответить.