简体   繁体   English

如何将变量附加到 CURL 命令

[英]How to append a variable to CURL command

I am trying to use curl qrenco.de/google.com with an alias so that the alias takes the input parameter google.com and appends it to curl qrenco.de/ .我正在尝试将curl qrenco.de/google.com与别名一起使用,以便别名采用输入参数google.com并将其附加到curl qrenco.de/ i want it to look something like this:我希望它看起来像这样:
$qrcode google.com

i have tried the following:我尝试了以下方法:
alias qrcode='curl qrenco.de/$(read)'

but this doesn't seem to work.但这似乎不起作用。 i am new to bash and would like to know the right approach.我是 bash 新手,想知道正确的方法。

几乎每次别名给您带来麻烦时,您都应该使用一个函数。

qrcode() { curl qrenco.de/"$1"; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM