TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Curl Command Line Variables

121 pointsby TangerineDreamalmost 2 years ago

6 comments

pierrebaialmost 2 years ago
I really feel this is reinventing the wheel and the resulting wheel is not quite round.<p>Would it not have been both simpler and more powerful to have a .curlrcscript file that gets executed and the output used as the config contents?<p>Even the original use case looks somewhat fishy: the user has secrets in their environment, but they can&#x27;t have a bash script or function wrapper around curl to call curl with the environment variable baked? Again, more general and powerful than a limited variable-replacement scheme using yet-another curl-specific syntax.<p>I can think of many examples where the direction curl went will backfire: people will want variable based on other variables. People will want variable based on conditions (if&#x2F;else), etc. All things a general scripting solution would fulfill in a standard way.
评论 #36944517 未加载
评论 #36944590 未加载
jiceaalmost 2 years ago
I maintain an Open Source HTTP client based on libcurl [1]. We have support for variables like {{foo}} and also add kind of filters (like these new curl functions that you can chain to refine values). It seems natural to have this kind of templating for an HTTP client now (for instance, when you want to make &quot;templatized&quot; script). Really a nice addition to curl.<p>[1]: <a href="https:&#x2F;&#x2F;hurl.dev" rel="nofollow noreferrer">https:&#x2F;&#x2F;hurl.dev</a>
评论 #36944247 未加载
评论 #36945406 未加载
nerdponxalmost 2 years ago
I wonder what the use case for this is, when every shell already offers parameter expansion of some kind. Is it so that you can write Curl command lines that work in any shell identically, once properly quoted?
评论 #36941000 未加载
评论 #36940973 未加载
评论 #36940967 未加载
conancatalmost 2 years ago
I love the beauty and elegance of curl&#x27;s design, seems to well thought out and practical
评论 #36942245 未加载
wackgetalmost 2 years ago
Why do the examples use two different styles of double quotes?<p>`--expand-data “{ \&quot;homedir\&quot;: \&quot;{{HOME:json}}\” &quot;`
评论 #36944536 未加载
评论 #36944551 未加载
ollienalmost 2 years ago
So how long until Curl is turing complete :)