Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmdline/variables.md: the syntax is tweaked #530

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions cmdline/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ You can assign the contents of a plain text file to a variable, too:

curl --variable varName@filename

Starting in curl 8.12.0, you can get a byte range from a given file by
appending `;[N-M]` to the file name, where `N` and `M` are numerical byte
offsets into the file where the second number can be omitted to mean until end
of file. For example, get the contents from a file from byte offset 100 to and
including byte offset 200:
Starting in curl 8.12.0, you can get a byte range from content by appending
`[N-M]` to the variable name, where `N` and `M` are numerical byte offsets
into the content where the second number can be omitted to mean until end of
data. For example, get the contents from a file from byte offset 100 to 199,
inclusive:

curl --variable "varName@filename;[100-200]"
curl --variable "varName[100-199]@filename"

Alternatively, get offset three to twelve from a plain text:

curl --variable "varName[3-12]=thefulltexttogetrangefrom"

Given a byte range that has no data results in an empty string. Asking for a
range that is larger than the content makes curl use the piece of the data
that exists.

## Expand

Expand Down
Loading